|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | 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 | |
ExecutableIterator |
createIterator()
Returns null - by default can't be iterated over |
ExecutableIterator |
createIterator(java.lang.String qualifier)
Returns null - by default can't be iterated over |
java.util.Hashtable |
getAttributes()
This method returns the attributes for this object. |
java.util.Hashtable |
getInstanceVariables()
This method returns the instance variables for this object. |
java.lang.String |
getSource(java.lang.String location)
This method returns the source for a scripted method described by the location. |
java.lang.Object |
getValue(java.lang.String field_name,
java.lang.String attrib,
ExecutableContext ctxt)
This method calls the Interpreter's reflectiveGetValue method |
java.lang.Object |
getValueAt(java.lang.Object array_index,
java.lang.String attrib,
ExecutableContext ctxt)
This method does nothing at this level |
java.lang.Object |
method(java.lang.String method_name,
java.lang.Object[] arguments,
ExecutableContext ctxt)
The following methods are supported directly by this class: |
void |
setValue(java.lang.String field_name,
java.lang.String attrib,
java.lang.Object value,
ExecutableContext ctxt)
This method calls the Interpreter's reflectiveSetValue method |
void |
setValueAt(java.lang.Object array_index,
java.lang.String attrib,
java.lang.Object value,
ExecutableContext ctxt)
This method does nothing at this level |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ExecutableRoot()
Method Detail |
public void setValue(java.lang.String field_name, java.lang.String attrib, java.lang.Object value, ExecutableContext ctxt) throws java.lang.RuntimeException, FieldNotSupportedException
setValue
in interface Executable
field_name
- the name of the fieldattrib
- the name of the attribute to be set (can be null)value
- the value to be setctxt
- the context the function is called within
java.lang.RuntimeException
- - if there was a problem running the script (such as not having permission to access a field)
FieldNotSupportedException
- - if the field could not be foundpublic void setValueAt(java.lang.Object array_index, java.lang.String attrib, java.lang.Object value, ExecutableContext ctxt) throws java.lang.RuntimeException
setValueAt
in interface Executable
array_index
- an object whose value indicates the index of the item in the collectionattrib
- the name of the attribute to be set (can be null)value
- the value to be setctxt
- the context the function is called within
java.lang.RuntimeException
- - if there was a problem running the scriptpublic java.lang.Object getValue(java.lang.String field_name, java.lang.String attrib, ExecutableContext ctxt) throws java.lang.RuntimeException, FieldNotSupportedException
getValue
in interface Executable
field_name
- the name of the fieldattrib
- attribute name (null if no attribute specified)ctxt
- the context the function is called within
java.lang.RuntimeException
- - if there was a problem running the script (such as not having permission to access a field)
FieldNotSupportedException
- - if the field could not be foundpublic java.lang.Object getValueAt(java.lang.Object array_index, java.lang.String attrib, ExecutableContext ctxt) throws java.lang.RuntimeException
getValueAt
in interface Executable
array_index
- an object whose value indicates the index of the item in the collectionattrib
- attribute name (null if no attribute specified)ctxt
- the context the function is called within
java.lang.RuntimeException
- - if there was a problem running the scriptpublic java.lang.Object method(java.lang.String method_name, java.lang.Object[] arguments, ExecutableContext ctxt) throws ParseException, java.lang.RuntimeException, MethodNotSupportedException
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
method_name
- the name of the methodarguments
- an array of arguments passed to the methodctxt
- the context the function is called within
java.lang.RuntimeException
- - if there was a problem running the script (such as divide by zero)
ParseException
MethodNotSupportedException
public ExecutableIterator createIterator()
createIterator
in interface Executable
public ExecutableIterator createIterator(java.lang.String qualifier)
createIterator
in interface Executable
qualifier
- - a string that can be used to qualify the iteration in any way
public java.lang.String getSource(java.lang.String location)
getSource
in interface Executable
location
- the location of the method - in the format passed to the execute functions in the Interpreter
public java.util.Hashtable getInstanceVariables()
getInstanceVariables
in interface Executable
public java.util.Hashtable getAttributes()
getAttributes
in interface Executable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |