Interface ClassReflectionHelper
- All Known Implementing Classes:
ClassReflectionHelperImpl
public interface ClassReflectionHelper
An interface representing useful reflection utilities
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Removes this class (and all appropriate sub-classes) from the cacheCreates a method wrapper from the given methodvoid
dispose()
Releases the entire cache, though the ClassReflectionHelper is still usable after calling disposefindPostConstruct
(Class<?> clazz, Class<?> matchingClass) Finds the postConstruct method on this classfindPreDestroy
(Class<?> clazz, Class<?> matchingClass) Finds the preDestroy method on this classgetAllFields
(Class<?> clazz) Gets all fields for a class (taking class heirarchy into account)getAllMethods
(Class<?> clazz) Gets all methods for a class (taking class heirarchy into account)int
size()
Returns an approximation of the current size of the cache
-
Method Details
-
getAllMethods
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
Creates a method wrapper from the given method- Parameters:
m
- A non-null method to create a wrapper from- Returns:
- A method wrapper
-
getAllFields
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
Finds the postConstruct method on this class- Parameters:
clazz
- The class to check for the postConstruct methodmatchingClass
- 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
Finds the preDestroy method on this class- Parameters:
clazz
- The class to check for the postConstruct methodmatchingClass
- 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
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
-