org.codehaus.plexus.util.reflection
public final class Reflector extends Object
Constructor Summary | |
---|---|
Reflector() Ensure no instances of Reflector are created...this is a utility. |
Method Summary | |
---|---|
Constructor | getConstructor(Class targetClass, Class[] params)
Return the constructor, checking the cache first and storing in cache if
not already there..
|
Object | getField(Object target, String fieldName) |
Object | getField(Object target, String fieldName, boolean breakAccessibility) |
Method | getMethod(Class targetClass, String methodName, Class[] params)
Return the method, checking the cache first and storing in cache if not
already there..
|
Object | getObjectProperty(Object target, String propertyName) |
Object | getSingleton(Class theClass, Object[] initParams)
Retrieve the singleton instance of a class, given the array of
parameters... |
Object | getStaticField(Class targetClass, String fieldName) |
Object | invoke(Object target, String methodName, Object[] params)
Invoke the specified method on the specified target with the specified
params...
|
Object | invokeStatic(Class targetClass, String methodName, Object[] params)
Invoke the specified static method with the specified params...
|
Object | newInstance(Class theClass, Object[] params)
Create a new instance of a class, given the array of parameters... |
Parameters: targetClass The class to get the constructor from params The classes of the parameters which the constructor should match.
Returns: the Constructor object that matches.
Throws: ReflectorException In case we can't retrieve the proper constructor.
Parameters: targetClass The class to get the method from params The classes of the parameters which the method should match.
Returns: the Method object that matches.
Throws: ReflectorException In case we can't retrieve the proper method.
Parameters: theClass The class to retrieve the singleton of initParams The parameters to pass to the constructor
Returns: The singleton object
Throws: ReflectorException In case anything goes wrong here...
Parameters: target The target of the invocation methodName The method name to invoke params The parameters to pass to the method invocation
Returns: The result of the method call
Throws: ReflectorException In case of an error looking up or invoking the method.
Parameters: targetClass The target class of the invocation methodName The method name to invoke params The parameters to pass to the method invocation
Returns: The result of the method call
Throws: ReflectorException In case of an error looking up or invoking the method.
Parameters: theClass The class to instantiate params The parameters to pass to the constructor
Returns: The instantiated object
Throws: ReflectorException In case anything goes wrong here...