Top Description Methods
org.glassfish.hk2.utilities.reflection

public Interface ClassReflectionHelper

Known Direct Implementers
org.glassfish.hk2.utilities.reflection.internal.ClassReflectionHelperImpl
Imports
java.lang.reflect.Field, .Method, java.util.Set

An interface representing useful reflection utilities
Author
jwells

Method Summary

Modifier and TypeMethod and Description
public void
clean(Class<?>
The class to remove. If null this method does nothing
clazz
)

Removes this class (and all appropriate sub-classes) from the cache

public MethodWrapper

Returns:

A method wrapper
createMethodWrapper
(Method
A non-null method to create a wrapper from
m
)

Creates a method wrapper from the given method

public void
dispose()

Releases the entire cache, though the ClassReflectionHelper is still usable after calling dispose

public Method

Returns:

A matching method, or null if none can be found
findPostConstruct
(Class<?>
The class to check for the postConstruct method
clazz
,
Class<?>
The PostConstruct interface, a small performance improvement
matchingClass
)

Finds the postConstruct method on this class

public Method

Returns:

A matching method, or null if none can be found
findPreDestroy
(Class<?>
The class to check for the postConstruct method
clazz
,
Class<?>
The PostConstruct interface, a small performance improvement
matchingClass
)

Finds the preDestroy method on this class

public Set<Field>

Returns:

The set of all fields on this class (and all subclasses)
getAllFields
(Class<?>
The class to analyze for all fields
clazz
)

Gets all fields for a class (taking class heirarchy into account)

public Set<MethodWrapper>

Returns:

The set of all methods on this class (and all subclasses)
getAllMethods
(Class<?>
The class to analyze for all methods
clazz
)

Gets all methods for a class (taking class heirarchy into account)

public int

Returns:

An approximation of the current size of the cache
size
()

Returns an approximation of the current size of the cache

Method Detail

cleanback to summary
public void clean(Class<?> clazz)

Removes this class (and all appropriate sub-classes) from the cache

Parameters
clazz:Class<?>

The class to remove. If null this method does nothing

createMethodWrapperback to summary
public MethodWrapper createMethodWrapper(Method m)

Creates a method wrapper from the given method

Parameters
m:Method

A non-null method to create a wrapper from

Returns:MethodWrapper

A method wrapper

disposeback to summary
public void dispose()

Releases the entire cache, though the ClassReflectionHelper is still usable after calling dispose

findPostConstructback to summary
public Method findPostConstruct(Class<?> clazz, Class<?> matchingClass) throws IllegalArgumentException

Finds the postConstruct method on this class

Parameters
clazz:Class<?>

The class to check for the postConstruct method

matchingClass:Class<?>

The PostConstruct interface, a small performance improvement

Returns:Method

A matching method, or null if none can be found

Exceptions
IllegalArgumentException:
If a method marked as postConstruct is invalid
findPreDestroyback to summary
public Method findPreDestroy(Class<?> clazz, Class<?> matchingClass) throws IllegalArgumentException

Finds the preDestroy method on this class

Parameters
clazz:Class<?>

The class to check for the postConstruct method

matchingClass:Class<?>

The PostConstruct interface, a small performance improvement

Returns:Method

A matching method, or null if none can be found

Exceptions
IllegalArgumentException:
If a method marked as postConstruct is invalid
getAllFieldsback to summary
public Set<Field> getAllFields(Class<?> clazz)

Gets all fields for a class (taking class heirarchy into account)

Parameters
clazz:Class<?>

The class to analyze for all fields

Returns:Set<Field>

The set of all fields on this class (and all subclasses)

getAllMethodsback to summary
public Set<MethodWrapper> getAllMethods(Class<?> clazz)

Gets all methods for a class (taking class heirarchy into account)

Parameters
clazz:Class<?>

The class to analyze for all methods

Returns:Set<MethodWrapper>

The set of all methods on this class (and all subclasses)

sizeback to summary
public int size()

Returns an approximation of the current size of the cache

Returns:int

An approximation of the current size of the cache