Class BasicRhinoShell
- All Implemented Interfaces:
Serializable, org.mozilla.javascript.ConstProperties, org.mozilla.javascript.debug.DebuggableObject, org.mozilla.javascript.Scriptable
Can execute scripts interactively or in batch mode at the command line. An example of controlling the JavaScript engine.
Based on Rhino.
- See Also:
-
Field Summary
Fields inherited from class org.mozilla.javascript.ScriptableObject
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONSTFields inherited from interface org.mozilla.javascript.Scriptable
NOT_FOUND -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidMain entry point.voidhelp()Print a help message.static voidload(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable thisObj, Object[] args, org.mozilla.javascript.Function funObj) Load and execute a set of JavaScript source files.static voidprint(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable thisObj, Object[] args, org.mozilla.javascript.Function funObj) Print the string values of its arguments.static String[]processOptions(org.mozilla.javascript.Context cx, String[] args) Parse arguments.voidquit()Quit the BasicRhinoShell.This method is defined as a JavaScript function.static doubleversion(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable thisObj, Object[] args, org.mozilla.javascript.Function funObj) Get and set the language version.static voidwarn(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable thisObj, Object[] args, org.mozilla.javascript.Function funObj) Warn.Methods inherited from class org.mozilla.javascript.ScriptableObject
associateValue, avoidObjectDetection, callMethod, callMethod, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, deleteProperty, deleteProperty, equivalentValues, get, get, getAllIds, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getDefaultValue, getFunctionPrototype, getGetterOrSetter, getIds, getObjectPrototype, getParentScope, getProperty, getProperty, getPropertyIds, getPrototype, getTopLevelScope, getTopScopeValue, has, has, hasInstance, hasProperty, hasProperty, isConst, isGetterOrSetter, isSealed, put, put, putConst, putConstProperty, putProperty, putProperty, redefineProperty, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setGetterOrSetter, setParentScope, setPrototype
-
Constructor Details
-
BasicRhinoShell
public BasicRhinoShell()
-
-
Method Details
-
getClassName
- Specified by:
getClassNamein interfaceorg.mozilla.javascript.Scriptable- Specified by:
getClassNamein classorg.mozilla.javascript.ScriptableObject
-
exec
Main entry point.Process arguments as would a normal Java program. Also create a new Context and associate it with the current thread. Then set up the execution environment and begin to execute scripts.
- Parameters:
args- the argsreporter- the reporter
-
processOptions
-
help
public void help()Print a help message.This method is defined as a JavaScript function.
-
print
public static void print(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable thisObj, Object[] args, org.mozilla.javascript.Function funObj) Print the string values of its arguments.This method is defined as a JavaScript function. Note that its arguments are of the "varargs" form, which allows it to handle an arbitrary number of arguments supplied to the JavaScript function.
- Parameters:
cx- the cxthisObj- the this objargs- the argsfunObj- the fun obj
-
quit
public void quit()Quit the BasicRhinoShell.This only affects the interactive mode.
This method is defined as a JavaScript function.
-
warn
public static void warn(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable thisObj, Object[] args, org.mozilla.javascript.Function funObj) Warn.- Parameters:
cx- the cxthisObj- the this objargs- the argsfunObj- the fun obj
-
readFile
-
version
public static double version(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable thisObj, Object[] args, org.mozilla.javascript.Function funObj) Get and set the language version.This method is defined as a JavaScript function.
- Parameters:
cx- the cxthisObj- the this objargs- the argsfunObj- the fun obj- Returns:
- the double
-
load
public static void load(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable thisObj, Object[] args, org.mozilla.javascript.Function funObj) Load and execute a set of JavaScript source files.This method is defined as a JavaScript function.
- Parameters:
cx- the cxthisObj- the this objargs- the argsfunObj- the fun obj
-