Class ResolverLookup

java.lang.Object
io.github.projectunified.craftcommand.processor.ResolverLookup

public final class ResolverLookup extends Object
Compile-time element lookups for resolver methods, suggest methods, and fields.
  • Method Details

    • findMethod

      public static ExecutableElement findMethod(TypeElement typeElement, String name)
      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 search
      name - the method name
      Returns:
      the matching ExecutableElement, or null if not found
    • findSuggestMethod

      public static ExecutableElement findSuggestMethod(TypeElement typeElement, String name)
      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 search
      name - the method name
      Returns:
      the matching method, or null if not found or invalid signature
    • isField

      public static boolean isField(TypeElement typeElement, String name)
      Checks if a type element declares a field with the given name.
      Parameters:
      typeElement - the type element
      name - the field name
      Returns:
      true if the type element declares a field with the given name.