public abstract class Configuration
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
protected BinaryOperator |
_add
object1 + object2
|
protected UnaryOperator |
_add1
object++, ++object
|
protected BinaryOperator |
_and
object1 & object2
|
protected BinaryOperator |
_divide
object1 / object2
|
protected BooleanOperator |
_eq
object1 == object2
|
protected BooleanOperator |
_ge
object1 >= object2
|
protected BooleanOperator |
_gt
object1 > object2
|
protected BooleanOperator |
_le
object1 <= object2
|
protected BooleanOperator |
_lt
object1 < object2
|
protected BinaryOperator |
_mod
object1 % object2
|
protected BinaryOperator |
_multiply
object1 * object2
|
protected UnaryOperator |
_negate
- object
|
protected UnaryOperator |
_not
~object
|
protected BinaryOperator |
_or
object1 | object2
|
protected BinaryOperator |
_shiftArithmetic
object1 >>> object2
|
protected BinaryOperator |
_shiftLeft
object1 < < object2
|
protected BinaryOperator |
_shiftRight
object1 >> object2
|
protected BinaryOperator |
_subtract
object1 - object2
|
protected UnaryOperator |
_subtract1
object--, object--
|
protected BinaryOperator |
_xor
object1 ^ object2
|
protected static Configuration |
normalConfiguration
The normal configuration, which is the fall-back of the default
configuration.
|
Constructor and Description |
---|
Configuration() |
Modifier and Type | Method and Description |
---|---|
abstract java.lang.Object |
callConstructor(Context context,
java.lang.Class c,
java.lang.Object[] args,
java.lang.Class[] types)
Calls a constructor
|
abstract 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
|
java.util.List |
createList() |
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 obj)
Defines how objects are printed in the interactive shell.
|
abstract java.lang.reflect.Constructor[] |
getConstructors(java.lang.Class cls)
Get all public constructors of the specified class.
|
static Configuration |
getDefault()
Returns the default Configuration object.
|
protected java.lang.String[] |
getDefaultImports()
Subclasses may redefines default imports
|
abstract java.lang.Object |
getElement(Context context,
java.lang.Object target,
java.lang.Object key)
Gets an array element
|
abstract java.lang.Object |
getField(Context context,
java.lang.Object target,
java.lang.String name)
Gets a field value of the target object.
|
protected java.lang.ClassLoader |
getInitialClassLoader() |
abstract java.lang.reflect.Method[] |
getMethods(java.lang.Class cls)
Get all public methods of the specified class.
|
abstract 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:
|
abstract 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.
|
protected void |
initializeOperators() |
protected static java.lang.Object |
invokeMethod(Context context,
java.lang.Class c,
java.lang.String name,
java.lang.Object[] args,
java.lang.Class[] types,
java.lang.Object target) |
java.lang.Object |
makeArray(java.lang.Object[] parameters,
Context context)
Return the value of an array expression.
|
abstract void |
putField(Context context,
java.lang.Object target,
java.lang.String name,
java.lang.Object value)
Sets a field value of the specified object.
|
abstract void |
putStaticField(Context context,
java.lang.Class clazz,
java.lang.String name,
java.lang.Object value)
Sets a value to the static field of the specified class.
|
abstract void |
setElement(Context context,
java.lang.Object target,
java.lang.Object key,
java.lang.Object value)
Sets an element
|
abstract 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:
|
abstract Callable |
toCallable(java.lang.Object obj)
Convert an object to Callable.
|
abstract java.util.Enumeration |
toEnumeration(java.lang.Object obj)
Convert an object to Enumeration.
|
protected static final Configuration normalConfiguration
protected BinaryOperator _add
protected BinaryOperator _subtract
protected BinaryOperator _multiply
protected BinaryOperator _mod
protected BinaryOperator _divide
protected BinaryOperator _shiftArithmetic
protected BinaryOperator _shiftLeft
protected BinaryOperator _shiftRight
protected BinaryOperator _and
protected BinaryOperator _or
protected BinaryOperator _xor
protected UnaryOperator _add1
protected UnaryOperator _subtract1
protected UnaryOperator _not
protected UnaryOperator _negate
protected BooleanOperator _eq
protected BooleanOperator _lt
protected BooleanOperator _le
protected BooleanOperator _gt
protected BooleanOperator _ge
public static Configuration getDefault()
protected java.lang.String[] getDefaultImports()
protected void initializeOperators()
public abstract java.lang.Object getStaticField(Context context, java.lang.Class clazz, java.lang.String name)
context
- the context in which the field is accessedclazz
- the class in which the static field is definedname
- the name of the static fieldpublic abstract void putStaticField(Context context, java.lang.Class clazz, java.lang.String name, java.lang.Object value)
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 abstract java.lang.Object getElement(Context context, java.lang.Object target, java.lang.Object key)
context
- the contexttarget
- the target object (an array)key
- the key or the index of the elementpublic abstract void setElement(Context context, java.lang.Object target, java.lang.Object key, java.lang.Object value)
context
- the contexttarget
- the target object (an array)key
- the key or the index of the elementvalue
- the new value of the elementpublic abstract 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)
context
- the contexctc
- the class of the methodname
- the name of the methodargs
- argumentstypes
- type information of each argumentstarget
- the target object of the method callpublic abstract java.lang.Object callConstructor(Context context, java.lang.Class c, java.lang.Object[] args, java.lang.Class[] types)
context
- the contextc
- class of the constructorargs
- the argumentstypes
- type information of each argumentspublic abstract java.lang.reflect.Method[] getMethods(java.lang.Class cls)
cls
- the classpublic abstract java.lang.reflect.Constructor[] getConstructors(java.lang.Class cls)
cls
- the classpublic abstract java.lang.Object getRange(Context context, java.lang.Object target, java.lang.Object idx1, java.lang.Object idx2)
target[idx1..idx2]
context
- the contexttarget
- the target objectidx1
- the start indexidx2
- the end index. null in idx2 means open-ended.public abstract 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
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 elementpublic abstract java.lang.Object getField(Context context, java.lang.Object target, java.lang.String name)
context
- the context in which the field is readtarget
- the target objectname
- the field namepublic abstract void putField(Context context, java.lang.Object target, java.lang.String name, java.lang.Object value)
context
- the context in which the field is written.target
- the target objectname
- the field namevalue
- the field valuepublic abstract java.util.Enumeration toEnumeration(java.lang.Object obj)
public abstract Callable toCallable(java.lang.Object obj)
public java.lang.Object handleUndefinedSymbol(java.lang.String symbol, Context context)
symbol
- the undefined symbolcontext
- the context in which the symbol is referencedpublic java.lang.Object makeArray(java.lang.Object[] parameters, Context context)
parameters
- the elements in the array expressionpublic java.util.Map createMap(int size, Context context)
size
- the map sizepublic java.util.List createList()
public java.lang.String formatObject(java.lang.Object obj)
obj
- the target object to printprotected static java.lang.Object invokeMethod(Context context, java.lang.Class c, java.lang.String name, java.lang.Object[] args, java.lang.Class[] types, java.lang.Object target)
protected java.lang.ClassLoader getInitialClassLoader()