|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpnuts.lang.Configuration
pnuts.ext.ConfigurationAdapter
public class ConfigurationAdapter
Field Summary | |
---|---|
protected Configuration |
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 | |
---|---|
ConfigurationAdapter()
Constructor |
|
ConfigurationAdapter(Configuration base)
Constructor |
Method Summary | |
---|---|
java.lang.Object |
callConstructor(Context context,
java.lang.Class c,
java.lang.Object[] args,
java.lang.Class[] types)
Call 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)
Call a method. |
java.util.Map |
createMap(int size,
Context context)
Create a new Map object that corresponds to {key=>value} expression. |
java.lang.String |
formatObject(java.lang.Object target)
String representation of an object |
java.lang.reflect.Constructor[] |
getConstructors(java.lang.Class cls)
Get all public constructors of the specified class. |
java.lang.Object |
getElement(Context context,
java.lang.Object target,
java.lang.Object key)
Gets an array element |
java.lang.Object |
getField(Context context,
java.lang.Object target,
java.lang.String name)
Gets a field of the specified class. |
java.lang.reflect.Method[] |
getMethods(java.lang.Class cls)
Get all public methods of the specified class. |
Configuration |
getParent()
Returns the parent configuration |
java.lang.Object |
getRange(Context context,
java.lang.Object target,
java.lang.Object idx1,
java.lang.Object idx2)
Defines the semantices of an expression like: |
java.lang.Object |
getStaticField(Context context,
java.lang.Class clazz,
java.lang.String name)
Get the value of a static field. |
java.lang.Object |
handleUndefinedSymbol(java.lang.String symbol,
Context context)
Handle an "not.defined" error This method can be redefined by a subclass so that a special value (e.g. |
java.lang.Object |
makeArray(java.lang.Object[] array,
Context context)
Return the value of an array expression. |
void |
putField(Context context,
java.lang.Object target,
java.lang.String name,
java.lang.Object value)
Sets a field of the specified class. |
void |
putStaticField(Context context,
java.lang.Class clazz,
java.lang.String name,
java.lang.Object value)
Sets a field of the specified class. |
void |
setElement(Context context,
java.lang.Object target,
java.lang.Object key,
java.lang.Object value)
Sets an array element |
java.lang.Object |
setRange(Context context,
java.lang.Object target,
java.lang.Object idx1,
java.lang.Object idx2,
java.lang.Object value)
Defines the semantices of an expression like: |
Callable |
toCallable(java.lang.Object obj)
Convert an object to Callable. |
java.util.Enumeration |
toEnumeration(java.lang.Object obj)
Convert an object to Enumeration. |
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 |
Field Detail |
---|
protected Configuration base
Constructor Detail |
---|
public ConfigurationAdapter()
public ConfigurationAdapter(Configuration base)
base
- the base configurationMethod Detail |
---|
public Configuration getParent()
public java.lang.Object getField(Context context, java.lang.Object target, java.lang.String name)
getField
in class Configuration
target
- the target objecgtname
- the field namecontext
- the context in which the field is read
public void putField(Context context, java.lang.Object target, java.lang.String name, java.lang.Object value)
putField
in class Configuration
context
- the context in which the field is written.target
- the target objecgtname
- the field namevalue
- the field valuepublic java.lang.Object getStaticField(Context context, java.lang.Class clazz, java.lang.String name)
getStaticField
in class Configuration
context
- the context in which the field is accessedclazz
- the class in which the static field is definedname
- the name of the static field
public void putStaticField(Context context, java.lang.Class clazz, java.lang.String name, java.lang.Object value)
putStaticField
in class Configuration
context
- the context in which the field is written.clazz
- the class in which the static field is definedname
- the field namevalue
- the field valuepublic 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)
callMethod
in class Configuration
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
public java.lang.Object callConstructor(Context context, java.lang.Class c, java.lang.Object[] args, java.lang.Class[] types)
callConstructor
in class Configuration
args
- the argumentscontext
- the contextc
- class of the constructortypes
- type information of each arguments
public java.lang.Object getElement(Context context, java.lang.Object target, java.lang.Object key)
getElement
in class Configuration
target
- the target object (an array)key
- a key or an index of the elementcontext
- the context
public void setElement(Context context, java.lang.Object target, java.lang.Object key, java.lang.Object value)
setElement
in class Configuration
target
- the target object (an array)key
- a key or an index of the elementvalue
- the new value of the elementcontext
- the contextpublic java.lang.reflect.Method[] getMethods(java.lang.Class cls)
getMethods
in class Configuration
cls
- the class
public java.lang.reflect.Constructor[] getConstructors(java.lang.Class cls)
getConstructors
in class Configuration
cls
- the class
public java.util.Enumeration toEnumeration(java.lang.Object obj)
toEnumeration
in class Configuration
public Callable toCallable(java.lang.Object obj)
toCallable
in class Configuration
public java.lang.Object handleUndefinedSymbol(java.lang.String symbol, Context context)
handleUndefinedSymbol
in class Configuration
symbol
- the undefined symbolcontext
- the context in which the symbol is referenced
public java.lang.Object makeArray(java.lang.Object[] array, Context context)
makeArray
in class Configuration
array
- the elements in the array expressioncontext
- the context
public java.util.Map createMap(int size, Context context)
createMap
in class Configuration
size
- the map size
public java.lang.String formatObject(java.lang.Object target)
formatObject
in class Configuration
target
- the target object to print
public java.lang.Object getRange(Context context, java.lang.Object target, java.lang.Object idx1, java.lang.Object idx2)
target[idx1..idx2]
getRange
in class Configuration
context
- the contexttarget
- the target objectidx1
- the start indexidx2
- the end index. null in idx2 means open-ended.
public java.lang.Object setRange(Context context, java.lang.Object target, java.lang.Object idx1, java.lang.Object idx2, java.lang.Object value)
target[idx1..idx2] = value
setRange
in class Configuration
context
- the context in which the assignment is donetarget
- the target objectidx1
- the start indexidx2
- the end index. null in idx2 means open-ended.value
- the new value of the indexed element
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |