Class ResolverLookup
java.lang.Object
io.github.projectunified.craftcommand.processor.ResolverLookup
Compile-time lookups for local resolvers, suggest methods, fields, and
command-model class resolution.
-
Method Summary
Modifier and TypeMethodDescriptionstatic ExecutableElementfindLocalResolver(CommandModel classModel, ParameterModel p) Find a local@Resolvemethod for the given parameter.static ExecutableElementfindMethod(TypeElement typeElement, String name) Find a no-arg/instance method by name on the given type element.static CommandModelfindModelForClass(CommandModel current, TypeElement targetClass) Walk the command tree to find theCommandModelwhose element equalstargetClass.static ExecutableElementfindSuggestMethod(TypeElement typeElement, String name) Find a suggest method by name and validate its signature.static booleanisField(TypeElement typeElement, String name) Checks if a type element declares a field with the given name.
-
Method Details
-
findMethod
Find a no-arg/instance method by name on the given type element. Searches the current class and all parent classes.- Parameters:
typeElement- the type element to searchname- the method name- Returns:
- the matching ExecutableElement, or null if not found
-
findLocalResolver
Find a local@Resolvemethod for the given parameter.If the parameter carries an explicit
@Resolve("name"), the method is matched by name. Implicit resolution by return type is no longer supported — use explicit@Resolve("name")instead.- Parameters:
classModel- the command class where resolution startsp- the parameter to resolve- Returns:
- the matching resolver method, or
nullif none
-
findModelForClass
Walk the command tree to find theCommandModelwhose element equalstargetClass.- Parameters:
current- the root or current command model to search fromtargetClass- the target class element- Returns:
- the matching CommandModel, or null if not found
-
findSuggestMethod
Find a suggest method by name and validate its signature.Valid signatures (where S is a sender type):
Collection<String> m()Collection<String> m(String[] current)Collection<String> m(String[] current, String[] context)Collection<String> m(S sender, String[] current)Collection<String> m(S sender, String[] current, String[] context)
- Parameters:
typeElement- the type element to searchname- the method name- Returns:
- the matching method, or
nullif not found or invalid signature
-
isField
Checks if a type element declares a field with the given name.- Parameters:
typeElement- the type elementname- the field name- Returns:
- true if the type element declares a field with the given name.
-