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.
Holds a ProcessingEnvironment for type comparison. Constructed
once per processor Processor.init(javax.annotation.processing.ProcessingEnvironment) call.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfindLocalResolver(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.findModelForClass(CommandModel current, TypeElement targetClass) Walk the command tree to find theCommandModelwhose element equalstargetClass.findSuggestMethod(TypeElement typeElement, String name) Find a suggest method by name and validate its signature.booleanisField(TypeElement typeElement, String name)
-
Constructor Details
-
ResolverLookup
-
-
Method Details
-
findMethod
Find a no-arg/instance method by name on the given type element. Searches the current class and all parent classes. -
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. -
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
- Returns:
- true if the type element declares a field with the given name.
-