|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--simkin.ExecutableRoot
This class provides an implementation of the Executable interface which can be conveniently extended
The class implements some commonly used methods via the method
function:
It also implements all the methods of the Executable
interface which means that derived classes need only implement the methods they need to override.
The class uses the Interpreter's reflection methods to look for public fields and method names which match those being accessed by the Simkin script.
Constructor Summary | |
ExecutableRoot()
|
Method Summary | |
java.lang.Object |
getValue(java.lang.String field_name,
java.lang.String attrib)
This method calls the Interpreter's reflectiveGetValue method |
java.lang.Object |
method(java.lang.String method_name,
java.lang.Object[] arguments)
The following methods are supported directly by this class: |
static void |
setTracer(TraceCallback cb)
This method sets the object which will receive trace calls when a trace is requested by a subclass |
void |
setValue(java.lang.String field_name,
java.lang.String attrib,
java.lang.Object value)
This method calls the Interpreter's reflectiveSetValue method |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ExecutableRoot()
Method Detail |
public static void setTracer(TraceCallback cb)
cb
- the object which will be called to output a trace messagepublic void setValue(java.lang.String field_name, java.lang.String attrib, java.lang.Object value) throws java.lang.RuntimeException, java.lang.NoSuchFieldException
setValue
in interface Executable
simkin.Executable
field_name
- the name of the fieldattrib_name
- the name of the attribute to be set (can be null)value
- the value to be setjava.lang.RuntimeException
- - if there was a problem running the script (such as not having permission to access a field)java.lang.NoSuchFieldException
- - if the field could not be foundpublic java.lang.Object getValue(java.lang.String field_name, java.lang.String attrib) throws java.lang.RuntimeException, java.lang.NoSuchFieldException
getValue
in interface Executable
simkin.Executable
field_name
- the name of the fieldattrib_name
- attribute name (null if no attribute specified)java.lang.RuntimeException
- - if there was a problem running the script (such as not having permission to access a field)java.lang.NoSuchFieldException
- - if the field could not be foundpublic java.lang.Object method(java.lang.String method_name, java.lang.Object[] arguments) throws ParseException, java.lang.RuntimeException, java.lang.NoSuchMethodException
trace(a) - sends a message to the trace output, takes a variable number of arguments
isObject(a) - returns true if a is an object (as opposed to an integer or string)
length(a) - returns the length of a (taken as a string)
charAt(str,index) - returns the character at the given index within the string
If the method is not one of these, the Interpreter's reflectiveMethodCall method is called
method
in interface Executable
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |