pnuts.ext
Class NonPublicMemberAccessor

java.lang.Object
  extended by pnuts.lang.Configuration
      extended by pnuts.ext.ConfigurationAdapter
          extended by pnuts.ext.PublicMemberAccessor
              extended by 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

Field Summary
 
Fields inherited from class pnuts.ext.ConfigurationAdapter
base
 
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
 
Constructor Summary
NonPublicMemberAccessor()
           
NonPublicMemberAccessor(Configuration conf)
           
 
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.PublicMemberAccessor
getObjectField, getStaticField, putObjectField, putStaticField
 
Methods inherited from class pnuts.ext.ConfigurationAdapter
callConstructor, createMap, formatObject, getElement, getParent, getRange, handleUndefinedSymbol, makeArray, setElement, setRange, toCallable, toEnumeration
 
Methods inherited from class pnuts.lang.Configuration
createList, getDefault, getDefaultImports, getInitialClassLoader, initializeOperators, invokeMethod
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NonPublicMemberAccessor

public NonPublicMemberAccessor()

NonPublicMemberAccessor

public NonPublicMemberAccessor(Configuration conf)
Method Detail

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 read
target - the target object
name - 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 object
name - the field name
value - 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 context
c - the class of the target object
name - the name of the method
args - the arguments
types - the type information of arguments
target - the target of the method call
Returns:
the methods return value