pnuts.ext
Class NonPublicMemberAccessor
java.lang.Object
pnuts.lang.Configuration
pnuts.ext.ConfigurationAdapter
pnuts.ext.PublicMemberAccessor
pnuts.ext.NonPublicMemberAccessor
- All Implemented Interfaces:
- java.io.Serializable
public class NonPublicMemberAccessor
- extends PublicMemberAccessor
when -a option is given to the pnuts command, this class is used so that
non-public members can be accessed.
- See Also:
- Serialized Form
Fields inherited from class pnuts.lang.Configuration |
_add, _add1, _and, _divide, _eq, _ge, _gt, _le, _lt, _mod, _multiply, _negate, _not, _or, _shiftArithmetic, _shiftLeft, _shiftRight, _subtract, _subtract1, _xor, normalConfiguration |
Method Summary |
java.lang.Object |
callMethod(Context context,
java.lang.Class c,
java.lang.String name,
java.lang.Object[] args,
java.lang.Class[] types,
java.lang.Object target)
Call a method. |
java.lang.reflect.Constructor[] |
getConstructors(java.lang.Class cls)
Get all public constructors of the specified class. |
protected java.lang.reflect.Field |
getField(java.lang.Class cls,
java.lang.String name)
|
java.lang.Object |
getField(Context context,
java.lang.Object target,
java.lang.String name)
Gets a field value of the target object. |
java.lang.reflect.Method[] |
getMethods(java.lang.Class cls)
Get all public methods of the specified class. |
void |
putField(Context context,
java.lang.Object target,
java.lang.String name,
java.lang.Object value)
Sets a field value of the specified object. |
Methods inherited from class pnuts.ext.ConfigurationAdapter |
callConstructor, createMap, formatObject, getElement, getParent, getRange, handleUndefinedSymbol, makeArray, setElement, setRange, toCallable, toEnumeration |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NonPublicMemberAccessor
public NonPublicMemberAccessor()
NonPublicMemberAccessor
public NonPublicMemberAccessor(Configuration conf)
getMethods
public java.lang.reflect.Method[] getMethods(java.lang.Class cls)
- Description copied from class:
ConfigurationAdapter
- Get all public methods of the specified class.
- Overrides:
getMethods
in class PublicMemberAccessor
- Parameters:
cls
- the class
- Returns:
- an array of Method objects
getConstructors
public java.lang.reflect.Constructor[] getConstructors(java.lang.Class cls)
- Description copied from class:
ConfigurationAdapter
- Get all public constructors of the specified class.
- Overrides:
getConstructors
in class PublicMemberAccessor
- Parameters:
cls
- the class
- Returns:
- an array of Constructor objects
getField
protected java.lang.reflect.Field getField(java.lang.Class cls,
java.lang.String name)
throws java.lang.NoSuchFieldException
- Overrides:
getField
in class PublicMemberAccessor
- Throws:
java.lang.NoSuchFieldException
getField
public java.lang.Object getField(Context context,
java.lang.Object target,
java.lang.String name)
- Gets a field value of the target object.
- Overrides:
getField
in class PublicMemberAccessor
- Parameters:
context
- the context in which the field is readtarget
- the target objectname
- the field name
- Returns:
- the field value
putField
public void putField(Context context,
java.lang.Object target,
java.lang.String name,
java.lang.Object value)
- Sets a field value of the specified object.
- Overrides:
putField
in class PublicMemberAccessor
- Parameters:
context
- the context in which the field is written.target
- the target objectname
- the field namevalue
- the field value
callMethod
public java.lang.Object callMethod(Context context,
java.lang.Class c,
java.lang.String name,
java.lang.Object[] args,
java.lang.Class[] types,
java.lang.Object target)
- Description copied from class:
ConfigurationAdapter
- Call a method.
- Overrides:
callMethod
in class ConfigurationAdapter
- Parameters:
context
- the contextc
- the class of the target objectname
- the name of the methodargs
- the argumentstypes
- the type information of argumentstarget
- the target of the method call
- Returns:
- the methods return value