Interface ClassReflectionHelper
-
- All Known Implementing Classes:
ClassReflectionHelperImpl
public interface ClassReflectionHelperAn interface representing useful reflection utilities
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclean(java.lang.Class<?> clazz)Removes this class (and all appropriate sub-classes) from the cacheMethodWrappercreateMethodWrapper(java.lang.reflect.Method m)Creates a method wrapper from the given methodvoiddispose()Releases the entire cache, though the ClassReflectionHelper is still usable after calling disposejava.lang.reflect.MethodfindPostConstruct(java.lang.Class<?> clazz, java.lang.Class<?> matchingClass)Finds the postConstruct method on this classjava.lang.reflect.MethodfindPreDestroy(java.lang.Class<?> clazz, java.lang.Class<?> matchingClass)Finds the preDestroy method on this classjava.util.Set<java.lang.reflect.Field>getAllFields(java.lang.Class<?> clazz)Gets all fields for a class (taking class heirarchy into account)java.util.Set<MethodWrapper>getAllMethods(java.lang.Class<?> clazz)Gets all methods for a class (taking class heirarchy into account)intsize()Returns an approximation of the current size of the cache
-
-
-
Method Detail
-
getAllMethods
java.util.Set<MethodWrapper> getAllMethods(java.lang.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(java.lang.reflect.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
java.util.Set<java.lang.reflect.Field> getAllFields(java.lang.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
java.lang.reflect.Method findPostConstruct(java.lang.Class<?> clazz, java.lang.Class<?> matchingClass) throws java.lang.IllegalArgumentExceptionFinds 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:
java.lang.IllegalArgumentException- If a method marked as postConstruct is invalid
-
findPreDestroy
java.lang.reflect.Method findPreDestroy(java.lang.Class<?> clazz, java.lang.Class<?> matchingClass) throws java.lang.IllegalArgumentExceptionFinds 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:
java.lang.IllegalArgumentException- If a method marked as postConstruct is invalid
-
clean
void clean(java.lang.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
-
-