|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.codehaus.plexus.util.reflection.Reflector
Utility class used to instantiate an object using reflection. This utility hides many of the gory details needed to do this.
Constructor Summary | |
Reflector()
Ensure no instances of Reflector are created...this is a utility. |
Method Summary | |
java.lang.reflect.Constructor |
getConstructor(java.lang.Class targetClass,
java.lang.Class[] params)
Return the constructor, checking the cache first and storing in cache if not already there.. |
java.lang.Object |
getField(java.lang.Object target,
java.lang.String fieldName)
|
java.lang.Object |
getField(java.lang.Object target,
java.lang.String fieldName,
boolean breakAccessibility)
|
java.lang.reflect.Method |
getMethod(java.lang.Class targetClass,
java.lang.String methodName,
java.lang.Class[] params)
Return the method, checking the cache first and storing in cache if not already there.. |
java.lang.Object |
getObjectProperty(java.lang.Object target,
java.lang.String propertyName)
|
java.lang.Object |
getSingleton(java.lang.Class theClass,
java.lang.Object[] initParams)
Retrieve the singleton instance of a class, given the array of parameters... |
java.lang.Object |
getStaticField(java.lang.Class targetClass,
java.lang.String fieldName)
|
java.lang.Object |
invoke(java.lang.Object target,
java.lang.String methodName,
java.lang.Object[] params)
Invoke the specified method on the specified target with the specified params... |
java.lang.Object |
invokeStatic(java.lang.Class targetClass,
java.lang.String methodName,
java.lang.Object[] params)
Invoke the specified static method with the specified params... |
java.lang.Object |
newInstance(java.lang.Class theClass,
java.lang.Object[] params)
Create a new instance of a class, given the array of parameters... |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Reflector()
Method Detail |
public java.lang.Object newInstance(java.lang.Class theClass, java.lang.Object[] params) throws ReflectorException
theClass
- The class to instantiateparams
- The parameters to pass to the constructor
ReflectorException
- In case anything goes wrong here...public java.lang.Object getSingleton(java.lang.Class theClass, java.lang.Object[] initParams) throws ReflectorException
theClass
- The class to retrieve the singleton ofinitParams
- The parameters to pass to the constructor
ReflectorException
- In case anything goes wrong here...public java.lang.Object invoke(java.lang.Object target, java.lang.String methodName, java.lang.Object[] params) throws ReflectorException
target
- The target of the invocationmethodName
- The method name to invokeparams
- The parameters to pass to the method invocation
ReflectorException
- In case of an error looking up or invoking the method.public java.lang.Object getStaticField(java.lang.Class targetClass, java.lang.String fieldName) throws ReflectorException
ReflectorException
public java.lang.Object getField(java.lang.Object target, java.lang.String fieldName) throws ReflectorException
ReflectorException
public java.lang.Object getField(java.lang.Object target, java.lang.String fieldName, boolean breakAccessibility) throws ReflectorException
ReflectorException
public java.lang.Object invokeStatic(java.lang.Class targetClass, java.lang.String methodName, java.lang.Object[] params) throws ReflectorException
targetClass
- The target class of the invocationmethodName
- The method name to invokeparams
- The parameters to pass to the method invocation
ReflectorException
- In case of an error looking up or invoking the method.public java.lang.reflect.Constructor getConstructor(java.lang.Class targetClass, java.lang.Class[] params) throws ReflectorException
targetClass
- The class to get the constructor fromparams
- The classes of the parameters which the constructor should
match.
ReflectorException
- In case we can't retrieve the proper constructor.public java.lang.Object getObjectProperty(java.lang.Object target, java.lang.String propertyName) throws ReflectorException
ReflectorException
public java.lang.reflect.Method getMethod(java.lang.Class targetClass, java.lang.String methodName, java.lang.Class[] params) throws ReflectorException
targetClass
- The class to get the method fromparams
- The classes of the parameters which the method should match.
ReflectorException
- In case we can't retrieve the proper method.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |