|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface RhinoHostObjectProvider
The RhinoHostObjectProvider
defines the service interface to
inject additional ECMAScript host objects as well as to make classes and
packages known.
Method Summary | |
---|---|
java.lang.Class<? extends org.mozilla.javascript.Scriptable>[] |
getHostObjectClasses()
Returns an array of classes implementing the Rhino Scriptable interface. |
java.lang.Class<?>[] |
getImportedClasses()
Returns an array of classes, which are transparently converted into ECMAScript host objects in the global scope. |
java.lang.String[] |
getImportedPackages()
Returns an array of Java package names to define name spaces in the global scope. |
Method Detail |
---|
java.lang.Class<? extends org.mozilla.javascript.Scriptable>[] getHostObjectClasses()
Scriptable
interface. These classes will be registered
with the global scope as host objects and may then be used in any
server-side ECMAScript scripts.
Implementations may return null
instead of an empty array
if they do not provide any host objects.
java.lang.Class<?>[] getImportedClasses()
Normally any Java class may be used within ECMAScript but it must be
prefixed with Packages
and the fully qualified package
name of the class. For example to use the class
org.slf4j.Log
in an ECMAScript it must be noted as
Packages.org.slf4j.Log
. By registering the
org.slf4j.Log
as an imported class, it may simply be
referred to as Log
(provided there is no other object of
that name, of course).
Implementations may return null
instead of an empty array
if they do not provide any imported classes.
java.lang.String[] getImportedPackages()
Normally any Java class may be used within ECMAScript but it must be
prefixed with Packages
and the fully qualified package
name of the class. For example to use the class
org.slf4j.Log
in an ECMAScript it must be noted as
Packages.org.slf4j.Log
. By registering the
org.slf4j
package as an imported package, it may simply be
referred to as Log
(provided there is no other object of
that name, of course).
The difference between importing packages and importing classes is that for a package import to work, the package must be visible to the ECMAScript bundle.
Implementations may return null
instead of an empty array
if they do not provide any package names.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |