org.jvoicexml.interpreter
Interface ScriptingEngine

All Known Implementing Classes:
RhinoScriptingEngine

public interface ScriptingEngine

Provide an interface to access different scripting engines.

Version:
$Revision: 216 $

Copyright © 2005-2007 JVoiceXML group - http://jvoicexml.sourceforge.net/

Author:
Torben Hardt, Dirk SChnelle

Method Summary
<T> T
createHostObject(String name, Class<T> template)
          Creates a host object in the scripting engine from the given java object.
 Object eval(String expr)
          Evaluates the given expression.
 Object getVariable(String name)
          Gets the variables current value.
 boolean isVariableDefined(String name)
          Checks, if the given variable is defined.
 void removeVariable(String name)
          Removes the given variable from the vault.
 void setVariable(String name, Object value)
          Sets a existing variable to a new value.
 

Method Detail

setVariable

void setVariable(String name,
                 Object value)
Sets a existing variable to a new value.

Parameters:
name - unique identifier
value - the new value of the variable

isVariableDefined

boolean isVariableDefined(String name)
Checks, if the given variable is defined.

Parameters:
name - Name of the variable to check.
Returns:
true if the variable is defined.

getVariable

Object getVariable(String name)
Gets the variables current value.

Parameters:
name - unique identifier
Returns:
the variables value object

removeVariable

void removeVariable(String name)
Removes the given variable from the vault.

Parameters:
name - unique identifier.

eval

Object eval(String expr)
            throws SemanticError
Evaluates the given expression.

Parameters:
expr - The expression to evaluate.
Returns:
Evaluated result.
Throws:
SemanticError - Error evaluating the expression.

createHostObject

<T> T createHostObject(String name,
                       Class<T> template)
                   throws SemanticError
Creates a host object in the scripting engine from the given java object.

Type Parameters:
T - Type of the host object.
Parameters:
name - Name of the shadow variable.
template - Base class of the host object.
Returns:
Created object.
Throws:
SemanticError - Error converting the given object to a host object.
Since:
0.3.1
Stuff to complete
Use a proper interface for host objects.


Copyright © 2005-2007 JVoiceXML group.