| java.lang.Object pnuts.lang.Configuration pnuts.ext.ConfigurationAdapter
All known Subclasses: org.pnuts.lib.AggregateConfiguration, pnuts.awt.EventQueueConfiguration, pnuts.lang.PublicMemberAccessor, pnuts.ext.LimitedClassesConfiguration,
Method Summary | |
public Object | callConstructor(Context context, Class c, Object[] args, Class[] types) Call a constructor. | public Object | callMethod(Context context, Class c, String name, Object args, Class types, Object target) Call a method. | public Map | createMap(int size, Context context) Create a new Map object that corresponds to {key=>value} expression. | public String | formatObject(Object target) | public Constructor[] | getConstructors(Class cls) Get all public constructors of the specified class. | public Object | getElement(Context context, Object target, Object key) | public Object | getField(Context context, Object target, String name) Gets a field of the specified class. | public Method[] | getMethods(Class cls) Get all public methods of the specified class. | public Configuration | getParent() | public Object | getRange(Context context, Object target, Object idx1, Object idx2) Defines the semantices of an expression like:
target[idx1..idx2]
Parameters: context - the context Parameters: target - the target object Parameters: idx1 - the start index Parameters: idx2 - the end index. | public Object | getStaticField(Context context, Class clazz, String name) Get the value of a static field. | public Object | handleUndefinedSymbol(String symbol, Context context) Handle an "not.defined" error
This method can be redefined by a subclass so that a special value (e.g. | public Object | makeArray(Object[] array, Context context) Return the value of an array expression. | public void | putField(Context context, Object target, String name, Object value) Sets a field of the specified class. | public void | putStaticField(Context context, Class clazz, String name, Object value) Sets a field of the specified class. | public void | setElement(Context context, Object target, Object key, Object value) | public Object | setRange(Context context, Object target, Object idx1, Object idx2, Object value) Defines the semantices of an expression like:
target[idx1..idx2] = value
Parameters: context - the context in which the assignment is done Parameters: target - the target object Parameters: idx1 - the start index Parameters: idx2 - the end index. | public Callable | toCallable(Object obj) Convert an object to Callable. | public Enumeration | toEnumeration(Object obj) Convert an object to Enumeration. |
ConfigurationAdapter | public ConfigurationAdapter()(Code) | | Constructor
|
ConfigurationAdapter | public ConfigurationAdapter(Configuration base)(Code) | | Constructor
Parameters: base - the base configuration |
callConstructor | public Object callConstructor(Context context, Class c, Object[] args, Class[] types)(Code) | | Call a constructor.
Parameters: args - the arguments the newly created and initialized object |
callMethod | public Object callMethod(Context context, Class c, String name, Object args, Class types, Object target)(Code) | | Call a method.
Parameters: context - the context Parameters: c - the class of the target object Parameters: name - the name of the method Parameters: args - the arguments Parameters: types - the type information of arguments Parameters: target - the target of the method call the methods return value |
createMap | public Map createMap(int size, Context context)(Code) | | Create a new Map object that corresponds to {key=>value} expression.
Parameters: size - the map size a new Map object |
formatObject | public String formatObject(Object target)(Code) | | String representation of an object
Parameters: target - the target object to print the string representation of the target object |
getConstructors | public Constructor[] getConstructors(Class cls)(Code) | | Get all public constructors of the specified class.
Parameters: cls - the class an array of Constructor objects |
getElement | public Object getElement(Context context, Object target, Object key)(Code) | | Gets an array element
Parameters: target - the target object (an array) Parameters: key - a key or an index of the element Parameters: context - the context the value of the element |
getField | public Object getField(Context context, Object target, String name)(Code) | | Gets a field of the specified class.
Parameters: target - the target objecgt Parameters: name - the field name Parameters: context - the context in which the field is read |
getMethods | public Method[] getMethods(Class cls)(Code) | | Get all public methods of the specified class.
Parameters: cls - the class an array of Method objects |
getRange | public Object getRange(Context context, Object target, Object idx1, Object idx2)(Code) | | Defines the semantices of an expression like:
target[idx1..idx2]
Parameters: context - the context Parameters: target - the target object Parameters: idx1 - the start index Parameters: idx2 - the end index. null in idx2 means open-ended. the result |
getStaticField | public Object getStaticField(Context context, Class clazz, String name)(Code) | | Get the value of a static field.
Parameters: context - the context in which the field is accessed Parameters: clazz - the class in which the static field is defined Parameters: name - the name of the static field the value |
handleUndefinedSymbol | public Object handleUndefinedSymbol(String symbol, Context context)(Code) | | Handle an "not.defined" error
This method can be redefined by a subclass so that a special value (e.g.
null) is returned when undefined symbol is referenced.
Parameters: symbol - the undefined symbol Parameters: context - the context in which the symbol is referenced the value to be returned |
makeArray | public Object makeArray(Object[] array, Context context)(Code) | | Return the value of an array expression. e.g. [a,b,c] {1,2,3}
This method can be redefined by a subclass so that array expression
returns different type of object, such as java.util.List.
Parameters: array - the elements in the array expression Parameters: context - the context the value of the array expression |
putField | public void putField(Context context, Object target, String name, Object value)(Code) | | Sets a field of the specified class.
Parameters: context - the context in which the field is written. Parameters: target - the target objecgt Parameters: name - the field name Parameters: value - the field value |
putStaticField | public void putStaticField(Context context, Class clazz, String name, Object value)(Code) | | Sets a field of the specified class.
Parameters: context - the context in which the field is written. Parameters: clazz - the class in which the static field is defined Parameters: name - the field name Parameters: value - the field value |
setElement | public void setElement(Context context, Object target, Object key, Object value)(Code) | | Sets an array element
Parameters: target - the target object (an array) Parameters: key - a key or an index of the element Parameters: value - the new value of the element Parameters: context - the context |
setRange | public Object setRange(Context context, Object target, Object idx1, Object idx2, Object value)(Code) | | Defines the semantices of an expression like:
target[idx1..idx2] = value
Parameters: context - the context in which the assignment is done Parameters: target - the target object Parameters: idx1 - the start index Parameters: idx2 - the end index. null in idx2 means open-ended. Parameters: value - the new value of the indexed element the result |
toCallable | public Callable toCallable(Object obj)(Code) | | Convert an object to Callable. This method is used by call expression, e.g. obj(arg1, ...).
Subclasses can override this method to register custom callable objects.
|
toEnumeration | public Enumeration toEnumeration(Object obj)(Code) | | Convert an object to Enumeration. This method is used by foreach
statements. Subclasses can override this method to customize the behavior
of foreach statements.
|
Methods inherited from pnuts.lang.Configuration | abstract public Object callConstructor(Context context, Class c, Object[] args, Class[] types)(Code)(Java Doc) abstract public Object callMethod(Context context, Class c, String name, Object args, Class types, Object target)(Code)(Java Doc) public List createList()(Code)(Java Doc) public Map createMap(int size, Context context)(Code)(Java Doc) public String formatObject(Object obj)(Code)(Java Doc) abstract public Constructor[] getConstructors(Class cls)(Code)(Java Doc) public static Configuration getDefault()(Code)(Java Doc) protected String[] getDefaultImports()(Code)(Java Doc) abstract public Object getElement(Context context, Object target, Object key)(Code)(Java Doc) abstract public Object getField(Context context, Object target, String name)(Code)(Java Doc) protected ClassLoader getInitialClassLoader()(Code)(Java Doc) abstract public Method[] getMethods(Class cls)(Code)(Java Doc) abstract public Object getRange(Context context, Object target, Object idx1, Object idx2)(Code)(Java Doc) abstract public Object getStaticField(Context context, Class clazz, String name)(Code)(Java Doc) public Object handleUndefinedSymbol(String symbol, Context context)(Code)(Java Doc) protected void initializeOperators()(Code)(Java Doc) protected static Object invokeMethod(Context context, Class c, String name, Object args, Class types, Object target)(Code)(Java Doc) public Object makeArray(Object[] parameters, Context context)(Code)(Java Doc) abstract public void putField(Context context, Object target, String name, Object value)(Code)(Java Doc) abstract public void putStaticField(Context context, Class clazz, String name, Object value)(Code)(Java Doc) abstract public void setElement(Context context, Object target, Object key, Object value)(Code)(Java Doc) abstract public Object setRange(Context context, Object target, Object idx1, Object idx2, Object value)(Code)(Java Doc) abstract public Callable toCallable(Object obj)(Code)(Java Doc) abstract public Enumeration toEnumeration(Object obj)(Code)(Java Doc)
|
|
|