public class ReflectWrapper
extends java.lang.Object
Constructor and Description |
---|
ReflectWrapper(java.lang.ClassLoader loader,
java.lang.String name)
Construct a wrapped object using the no arg constructor.
|
ReflectWrapper(java.lang.Object obj)
Constructor using a passed in object.
|
Modifier and Type | Method and Description |
---|---|
<T> T |
getObject() |
<T> T |
invoke(java.lang.String methodName)
Call a method on the object with no parameters.
|
<T> T |
invoke(java.lang.String methodName,
java.lang.Class<?> argType,
java.lang.Object arg)
Call a method on the object with one argument.
|
<T> T |
invoke(java.lang.String methodName,
java.lang.Class<?> argType1,
java.lang.Object arg1,
java.lang.Class<?> argType2,
java.lang.Object arg2)
Call a method on the object with one argument.
|
public ReflectWrapper(java.lang.ClassLoader loader, java.lang.String name)
loader
- the classloader to use to construct the class.name
- the classname of the object to construct.public ReflectWrapper(java.lang.Object obj)
obj
- the object to wrap.public <T> T getObject()
T
- desired typepublic <T> T invoke(java.lang.String methodName)
T
- desired typemethodName
- the name of the method to callpublic <T> T invoke(java.lang.String methodName, java.lang.Class<?> argType, java.lang.Object arg)
T
- desired typemethodName
- the name of the method to callargType
- the type of argument.arg
- the value of the argument.public <T> T invoke(java.lang.String methodName, java.lang.Class<?> argType1, java.lang.Object arg1, java.lang.Class<?> argType2, java.lang.Object arg2)
T
- desired typemethodName
- the name of the method to callargType1
- the type of the first argument.arg1
- the value of the first argument.argType2
- the type of the second argument.arg2
- the value of the second argument.