| java.lang.Object instantj.reflect.ReflectAccess
ReflectAccess | public class ReflectAccess (Code) | | The class providing reflection operations - have a look at the
list of methods to find out what this thing provides.
author: Nils Meier |
Method Summary | |
public String | calcAccessor(String prefix, String property) | public Object[] | calcArrayWrap(Object object) | public Class | calcClassFromName(String name) | public String | calcClassNameOf(Class theClass) | public Class[] | calcClassesFromObjects(Object[] args) | public Method | calcMethodFor(Object object, String method, Class[] args) | public String | calcPkgNameOf(Class theClass) | public Object | calcWrapping(Object object, Class target) Tries to wrap a given object in an instance of given target
type by calling that type's one-argument-constructor. | public static ReflectAccess | getInstance() | public Object | invoke(Object instance, String method, Object[] args) | public Object | invokeGetter(Object object, String property) | public void | invokeSetter(Object object, String property, Object arg) | public void | setField(Object object, String property, Object value) | public void | setField(Object object, String property, Object value, boolean wrapValueIfNeeded) |
calcAccessor | public String calcAccessor(String prefix, String property)(Code) | | Returns a getter/setter method name for given property
|
calcArrayWrap | public Object[] calcArrayWrap(Object object)(Code) | | Helper that wraps an Object into an Array
|
calcClassNameOf | public String calcClassNameOf(Class theClass)(Code) | | Returns the class name without package for given class
|
calcClassesFromObjects | public Class[] calcClassesFromObjects(Object[] args)(Code) | | Helper which calculates a Class array for given Object array
|
calcPkgNameOf | public String calcPkgNameOf(Class theClass)(Code) | | Returns the package name without classname for given class
|
calcWrapping | public Object calcWrapping(Object object, Class target) throws IllegalArgumentException(Code) | | Tries to wrap a given object in an instance of given target
type by calling that type's one-argument-constructor.
Parameters: object - the to be wrapped Parameters: target - the wrapper type |
invokeGetter | public Object invokeGetter(Object object, String property) throws IllegalPropertyException, InaccessiblePropertyException(Code) | | Invokes a getter on given object - the property XYZ
has to reflect the object's methods getXYZ or isXYZ
Mental Note: if an inner type is 'private static' AND
has a public method, an attempt to invoke it will lead
to an IllegalAccessException (Arrays.asList() for example
returns a type 'Arrays$ArrayList' that is 'private static')
in JDK 1.3
|
setField | public void setField(Object object, String property, Object value, boolean wrapValueIfNeeded) throws IllegalPropertyException, InaccessiblePropertyException(Code) | | Sets a field on given object
Parameters: object - the instance to set property on Parameters: property - the property to set on the instance Parameters: value - the value to set Parameters: wrapValueIfNeeded - whether to try to wrap a value with a field-type one-argument-constructor if necessary |
|
|