pnuts.lang
Class JavaBeansConfiguration

java.lang.Object
  extended by pnuts.lang.Configuration
      extended by pnuts.lang.JavaBeansConfiguration
All Implemented Interfaces:
java.io.Serializable

public abstract class JavaBeansConfiguration
extends Configuration

This is a configuration for JavaBeans. Only methods in method descriptors can be called. Field access expression reads/writes property of the Beans.

See Also:
Serialized Form

Field Summary
 
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
JavaBeansConfiguration()
          Constructor
JavaBeansConfiguration(java.lang.Class stopClass)
          Constructor
 
Method Summary
 java.lang.Object callConstructor(Context context, java.lang.Class c, java.lang.Object[] args, java.lang.Class[] types)
          Calls a constructor
 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)
          Calls a method
protected  java.lang.Object getBeanProperty(Context context, java.lang.Object target, java.lang.String name)
          Gets a Bean property of the specified bean.
 java.lang.reflect.Constructor[] getConstructors(java.lang.Class cls)
          Get all public constructors of the specified class.
 java.lang.Object getField(Context context, java.lang.Object target, java.lang.String name)
          Gets a Bean property of the specified bean.
 java.lang.reflect.Method[] getMethods(java.lang.Class cls)
          Collects the Bean methods for the specified class.
protected  java.lang.Class getStopClass()
           
 void putField(Context context, java.lang.Object target, java.lang.String name, java.lang.Object value)
          Sets a Bean property of the specified bean.
protected  void setBeanProperty(Context context, java.lang.Object target, java.lang.String name, java.lang.Object value)
          Sets a Bean property of the specified bean.
 
Methods inherited from class pnuts.lang.Configuration
createList, createMap, formatObject, getDefault, getDefaultImports, getElement, getInitialClassLoader, getRange, getStaticField, handleUndefinedSymbol, initializeOperators, invokeMethod, makeArray, putStaticField, setElement, setRange, toCallable, toEnumeration
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JavaBeansConfiguration

public JavaBeansConfiguration()
Constructor


JavaBeansConfiguration

public JavaBeansConfiguration(java.lang.Class stopClass)
Constructor

Method Detail

getStopClass

protected java.lang.Class getStopClass()

getMethods

public java.lang.reflect.Method[] getMethods(java.lang.Class cls)
Collects the Bean methods for the specified class.

Specified by:
getMethods in class Configuration
Parameters:
cls - the class
Returns:
an array of Method objects

getConstructors

public java.lang.reflect.Constructor[] getConstructors(java.lang.Class cls)
Get all public constructors of the specified class.

Specified by:
getConstructors in class Configuration
Parameters:
cls - the class
Returns:
an array of Constructor objects

getField

public java.lang.Object getField(Context context,
                                 java.lang.Object target,
                                 java.lang.String name)
Gets a Bean property of the specified bean.

Specified by:
getField in class Configuration
Parameters:
context - the context in which the property is read
target - the target bean
name - the Bean property name
Returns:
the field value

getBeanProperty

protected java.lang.Object getBeanProperty(Context context,
                                           java.lang.Object target,
                                           java.lang.String name)
Gets a Bean property of the specified bean.

Parameters:
context - the context in which the property is read
target - the target bean
name - the Bean property name

putField

public void putField(Context context,
                     java.lang.Object target,
                     java.lang.String name,
                     java.lang.Object value)
Sets a Bean property of the specified bean.

Specified by:
putField in class Configuration
Parameters:
context - the context in which the property is read
target - the target bean
name - the Bean property name
value - the new property value

setBeanProperty

protected void setBeanProperty(Context context,
                               java.lang.Object target,
                               java.lang.String name,
                               java.lang.Object value)
Sets a Bean property of the specified bean.

Parameters:
context - the context in which the property is read
target - the target bean
name - the Bean property name
value - the new property 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)
Calls a method

Specified by:
callMethod in class Configuration
Parameters:
context - the contexct
c - the class of the method
name - the name of the method
args - arguments
types - type information of each arguments
target - the target object of the method call
Returns:
the result of the method call

callConstructor

public java.lang.Object callConstructor(Context context,
                                        java.lang.Class c,
                                        java.lang.Object[] args,
                                        java.lang.Class[] types)
Calls a constructor

Specified by:
callConstructor in class Configuration
Parameters:
context - the context
c - class of the constructor
args - the arguments
types - type information of each arguments
Returns:
the result