Interface ClassReflectionHelper

  • All Known Implementing Classes:
    ClassReflectionHelperImpl

    public interface ClassReflectionHelper
    An interface representing useful reflection utilities
    Author:
    jwells
    • Method Detail

      • getAllMethods

        Set<MethodWrapper> getAllMethods​(Class<?> clazz)
        Gets all methods for a class (taking class heirarchy into account)
        Parameters:
        clazz - The class to analyze for all methods
        Returns:
        The set of all methods on this class (and all subclasses)
      • createMethodWrapper

        MethodWrapper createMethodWrapper​(Method m)
        Creates a method wrapper from the given method
        Parameters:
        m - A non-null method to create a wrapper from
        Returns:
        A method wrapper
      • getAllFields

        Set<Field> getAllFields​(Class<?> clazz)
        Gets all fields for a class (taking class heirarchy into account)
        Parameters:
        clazz - The class to analyze for all fields
        Returns:
        The set of all fields on this class (and all subclasses)
      • findPostConstruct

        Method findPostConstruct​(Class<?> clazz,
                                 Class<?> matchingClass)
                          throws IllegalArgumentException
        Finds the postConstruct method on this class
        Parameters:
        clazz - The class to check for the postConstruct method
        matchingClass - The PostConstruct interface, a small performance improvement
        Returns:
        A matching method, or null if none can be found
        Throws:
        IllegalArgumentException - If a method marked as postConstruct is invalid
      • findPreDestroy

        Method findPreDestroy​(Class<?> clazz,
                              Class<?> matchingClass)
                       throws IllegalArgumentException
        Finds the preDestroy method on this class
        Parameters:
        clazz - The class to check for the postConstruct method
        matchingClass - The PostConstruct interface, a small performance improvement
        Returns:
        A matching method, or null if none can be found
        Throws:
        IllegalArgumentException - If a method marked as postConstruct is invalid
      • clean

        void clean​(Class<?> clazz)
        Removes this class (and all appropriate sub-classes) from the cache
        Parameters:
        clazz - The class to remove. If null this method does nothing
      • dispose

        void dispose()
        Releases the entire cache, though the ClassReflectionHelper is still usable after calling dispose
      • size

        int size()
        Returns an approximation of the current size of the cache
        Returns:
        An approximation of the current size of the cache