Class ClassReflectionHelperImpl
- java.lang.Object
-
- org.glassfish.hk2.utilities.reflection.internal.ClassReflectionHelperImpl
-
- All Implemented Interfaces:
ClassReflectionHelper
public class ClassReflectionHelperImpl extends Object implements ClassReflectionHelper
- Author:
- jwells
-
-
Constructor Summary
Constructors Constructor Description ClassReflectionHelperImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clean(Class<?> clazz)
Removes this class (and all appropriate sub-classes) from the cacheMethodWrapper
createMethodWrapper(Method m)
Creates a method wrapper from the given methodvoid
dispose()
Releases the entire cache, though the ClassReflectionHelper is still usable after calling disposeMethod
findPostConstruct(Class<?> clazz, Class<?> matchingClass)
Finds the postConstruct method on this classMethod
findPreDestroy(Class<?> clazz, Class<?> matchingClass)
Finds the preDestroy method on this classSet<Field>
getAllFields(Class<?> clazz)
Gets all fields for a class (taking class heirarchy into account)Set<MethodWrapper>
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 cacheString
toString()
-
-
-
Method Detail
-
getAllMethods
public Set<MethodWrapper> getAllMethods(Class<?> clazz)
Description copied from interface:ClassReflectionHelper
Gets all methods for a class (taking class heirarchy into account)- Specified by:
getAllMethods
in interfaceClassReflectionHelper
- Parameters:
clazz
- The class to analyze for all methods- Returns:
- The set of all methods on this class (and all subclasses)
-
getAllFields
public Set<Field> getAllFields(Class<?> clazz)
Description copied from interface:ClassReflectionHelper
Gets all fields for a class (taking class heirarchy into account)- Specified by:
getAllFields
in interfaceClassReflectionHelper
- Parameters:
clazz
- The class to analyze for all fields- Returns:
- The set of all fields on this class (and all subclasses)
-
findPostConstruct
public Method findPostConstruct(Class<?> clazz, Class<?> matchingClass) throws IllegalArgumentException
Description copied from interface:ClassReflectionHelper
Finds the postConstruct method on this class- Specified by:
findPostConstruct
in interfaceClassReflectionHelper
- 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
public Method findPreDestroy(Class<?> clazz, Class<?> matchingClass) throws IllegalArgumentException
Description copied from interface:ClassReflectionHelper
Finds the preDestroy method on this class- Specified by:
findPreDestroy
in interfaceClassReflectionHelper
- 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
public void clean(Class<?> clazz)
Description copied from interface:ClassReflectionHelper
Removes this class (and all appropriate sub-classes) from the cache- Specified by:
clean
in interfaceClassReflectionHelper
- Parameters:
clazz
- The class to remove. If null this method does nothing
-
createMethodWrapper
public MethodWrapper createMethodWrapper(Method m)
Description copied from interface:ClassReflectionHelper
Creates a method wrapper from the given method- Specified by:
createMethodWrapper
in interfaceClassReflectionHelper
- Parameters:
m
- A non-null method to create a wrapper from- Returns:
- A method wrapper
-
dispose
public void dispose()
Description copied from interface:ClassReflectionHelper
Releases the entire cache, though the ClassReflectionHelper is still usable after calling dispose- Specified by:
dispose
in interfaceClassReflectionHelper
-
size
public int size()
Description copied from interface:ClassReflectionHelper
Returns an approximation of the current size of the cache- Specified by:
size
in interfaceClassReflectionHelper
- Returns:
- An approximation of the current size of the cache
-
-