FESI.jslib
Interface JSObject

All Known Subinterfaces:
JSGlobalObject

public interface JSObject

Interface used for interfacing the FESI EcmaScript interpreter with Java code. Based and largely compatible with the Netscape JavaScript to Java interface.

This interface is exported by FESI objects, it is not intended or useful for user objects to extend this interface.

Non function objects need not implement any specific interface, FESI using introspection to discover their properties. Function objects must implement JSFunction.


Method Summary
 java.lang.Object call(java.lang.String methodName, java.lang.Object[] args)
          Call the specified EcmaScript method of this object
 java.lang.Object eval(java.io.Reader r, java.lang.String d)
          Evaluate a Reader stream with this object as the 'this' object.
 java.lang.Object eval(java.lang.String s)
          Evaluate a string with this object as the 'this' object.
 java.lang.Object evalAsFunction(java.lang.String s)
          Evaluate a string with this object as the 'this' object.
 java.lang.Object evalAsFunction(java.lang.String s, java.lang.String[] names, java.lang.Object[] values)
          Evaluate a string with this object as the 'this' object.
 JSGlobalObject getGlobalObject()
          Get the global object of the interpreter
 java.lang.Object getMember(java.lang.String name)
          Get the named property of this object.
 java.lang.Object getSlot(int index)
          Get the indexed property of this object (useful for arrays).
 void removeMember(java.lang.String name)
          Delete a named property of this object
 void setMember(java.lang.String name, java.lang.Object value)
          Set the value of a named property of this object
 void setSlot(int index, java.lang.Object value)
          Set a property by index value.
 

Method Detail

call

public java.lang.Object call(java.lang.String methodName,
                             java.lang.Object[] args)
                      throws JSException
Call the specified EcmaScript method of this object

Parameters:
methodName - The name of the method to call
args - An array of parameters.
Returns:
The result of the evaluation
Throws:
JSException - For any error during interpretation

eval

public java.lang.Object eval(java.lang.String s)
                      throws JSException
Evaluate a string with this object as the 'this' object. Consider the string being a main program, not allowing the return statement.

Parameters:
s - The string to evaluate
Returns:
The result of the evaluation (null if no value returned)
Throws:
JSException - For any error during interpretation

eval

public java.lang.Object eval(java.io.Reader r,
                             java.lang.String d)
                      throws JSException
Evaluate a Reader stream with this object as the 'this' object. Consider the stream being a main program, not allowing the return statement.

Parameters:
r - The Reader stream to evaluate
d - A description of the Reader for error messages
Returns:
The result of the evaluation (null if no value returned)
Throws:
JSException - For any error during interpretation

evalAsFunction

public java.lang.Object evalAsFunction(java.lang.String s)
                                throws JSException
Evaluate a string with this object as the 'this' object. Consider the string as a function, allowing the return statement.

Parameters:
s - The string to evaluate
Returns:
The result of the evaluation (null if no value returned)
Throws:
JSException - For any error during interpretation

evalAsFunction

public java.lang.Object evalAsFunction(java.lang.String s,
                                       java.lang.String[] names,
                                       java.lang.Object[] values)
                                throws JSException
Evaluate a string with this object as the 'this' object. Consider the string as a function, allowing the return statement. Passing the specified parameters (names and values must have the same length)

Parameters:
s - The string to evaluate
names - the names of the parameters
values - the values of the parameters
Returns:
The result of the evaluation (null if no value returned)
Throws:
JSException - For any error during interpretation

getMember

public java.lang.Object getMember(java.lang.String name)
                           throws JSException
Get the named property of this object.

Parameters:
name - The name of the property to get
Returns:
The value of the property
Throws:
JSException - For any error during interpretation

getSlot

public java.lang.Object getSlot(int index)
                         throws JSException
Get the indexed property of this object (useful for arrays).

Parameters:
index - The index value of the property (converted to string if not an array)
Returns:
The value of the property
Throws:
JSException - For any error during interpretation

removeMember

public void removeMember(java.lang.String name)
                  throws JSException
Delete a named property of this object

Parameters:
name - The name of the property to delete
Throws:
JSException - For any error during interpretation

setMember

public void setMember(java.lang.String name,
                      java.lang.Object value)
               throws JSException
Set the value of a named property of this object

Parameters:
name - The name of the property to set
value - The value to set the property to.
Throws:
JSException - For any error during interpretation

setSlot

public void setSlot(int index,
                    java.lang.Object value)
             throws JSException
Set a property by index value. Useful for arrays.

Parameters:
index - The index of the property in the array.
value - The value to set the property to.
Throws:
JSException - For any error during interpretation

getGlobalObject

public JSGlobalObject getGlobalObject()
Get the global object of the interpreter

Returns:
JSGlobalObject


IBM Tivoli Identity Manager 4.6
© Copyright International Business Machines Corporation 2005. All rights reserved. US Government Users Restricted Rights Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.