Class ClassReflectionIndex


  • public final class ClassReflectionIndex
    extends Object
    A short-lived index of all the declared fields and methods of a class.

    The ClassReflectionIndex is only available during the deployment.

    Author:
    David M. Lloyd
    • Method Detail

      • getIndexedClass

        public Class<?> getIndexedClass()
        Get the class indexed by this object.
        Returns:
        the class
      • getField

        public Field getField​(String name)
        Get a field declared on this object.
        Parameters:
        name - the field name
        Returns:
        the field, or null if no field of that name exists
      • getFields

        public Collection<Field> getFields()
        Get a collection of fields declared on this object.
        Returns:
        The (possibly empty) collection of all declared fields on this object
      • getMethod

        public Method getMethod​(Class<?> returnType,
                                String name,
                                Class<?>... paramTypes)
        Get a method declared on this object.
        Parameters:
        returnType - the method return type
        name - the name of the method
        paramTypes - the parameter types of the method
        Returns:
        the method, or null if no method of that description exists
      • getMethod

        public Method getMethod​(Method method)
        Get the canonical method declared on this object.
        Parameters:
        method - the method to look up
        Returns:
        the canonical method object, or null if no matching method exists
      • getMethod

        public Method getMethod​(String returnType,
                                String name,
                                String... paramTypeNames)
        Get a method declared on this object.
        Parameters:
        returnType - the method return type name
        name - the name of the method
        paramTypeNames - the parameter type names of the method
        Returns:
        the method, or null if no method of that description exists
      • getMethod

        public Method getMethod​(org.jboss.invocation.proxy.MethodIdentifier methodIdentifier)
        Get a method declared on this object.
        Parameters:
        methodIdentifier - the method identifier
        Returns:
        the method, or null if no method of that description exists
      • getMethods

        public Collection<Method> getMethods​(String name,
                                             Class<?>... paramTypes)
        Get a collection of methods declared on this object.
        Parameters:
        name - the name of the method
        paramTypes - the parameter types of the method
        Returns:
        the (possibly empty) collection of methods matching the description
      • getMethods

        public Collection<Method> getMethods​(String name,
                                             String... paramTypeNames)
        Get a collection of methods declared on this object.
        Parameters:
        name - the name of the method
        paramTypeNames - the parameter type names of the method
        Returns:
        the (possibly empty) collection of methods matching the description
      • getAllMethods

        public Collection<Method> getAllMethods​(String name)
        Get a collection of methods declared on this object by method name.
        Parameters:
        name - the name of the method
        Returns:
        the (possibly empty) collection of methods with the given name
      • getAllMethods

        public Collection<Method> getAllMethods​(String name,
                                                int paramCount)
        Get a collection of methods declared on this object by method name and parameter count.
        Parameters:
        name - the name of the method
        paramCount - the number of parameters
        Returns:
        the (possibly empty) collection of methods with the given name and parameter count
      • getMethods

        public Collection<Method> getMethods()
        Get a collection of methods declared on this object.
        Returns:
        the (possibly empty) collection of all declared methods
      • getConstructors

        public Collection<Constructor<?>> getConstructors()
        Get the full collection of constructors declared on this object.
        Returns:
        the constructors
      • getConstructor

        public Constructor<?> getConstructor​(Class<?>... paramTypes)
        Get a constructor declared on this class.
        Parameters:
        paramTypes - the constructor argument types
        Returns:
        the constructor, or null of no such constructor exists
      • getConstructor

        public Constructor<?> getConstructor​(String... paramTypeNames)
        Get a constructor declared on this class.
        Parameters:
        paramTypeNames - the constructor argument type names
        Returns:
        the constructor, or null of no such constructor exists
      • getClassMethods

        public Set<Method> getClassMethods()