These APIs provide methods for
controlling the actions of JavaScript in a host environment.
Context - Represents the runtime context of an
executing script. Has methods to associate the JavaScript evaluation engine
with a Java thread, set attributes of the engine, and compile and evaluate
scripts.
Script - The result of compiling a JavaScript
script. Also encapsulates script execution.
FlattenedObject - Allows easy manipulation of JavaScript object
using a flattened prototype chain.
ErrorReporter - This interface can be implemented to control the
actions the JavaScript engine takes when it encounters errors.
SecuritySupport - Optional support routines that must be provided
by embeddings implementing security controls on scripts.
The Host Object API
These APIs provide support for
adding objects specific to a particular embedding of JavaScript in a host
environment. Note that if you just want to script existing Java classes, you
should just use LiveConnect. It is also helpful to understand some of
the implementation of the runtime.
Scriptable - All JavaScript objects must implement
this interface. Provides methods to access properties and attributes of
those properties, as well as other services required of JavaScript objects.
Function - All JavaScript functions must implement
this interface. Extends Scriptable, adding methods to support invocation.
ScriptableObject - A default implementation of Scriptable that may
be extended. Implements property and attribute storage and lookup and other
default JavaScript object behavior.
FunctionObject - An implementation of Function that allows Java
methods and constructors to be used as JavaScript function objects.
Exceptions
These exceptions are thrown by
JavaScript.
JavaScriptException - Thrown from within JavaScript by the
JavaScript 'throw' statement, or by LiveConnect calls from JavaScript into
Java. Wraps a JavaScript value.
ClassDefinitionException - Thrown if errors are detected while
attempting to define a host object from a Java class.
PropertyException - Thrown if errors are detected while attempting
to define a property of a host object from a Java class or method, or if a
property is not found.
NotAFunctionException - Thrown when attempting to call an object
that is not a function.
EvaluatorException - An exception thrown when an error is detected
during the execution of a script. The default error reporter will throw
EvaluatorExceptions when an error is encountered.