Class BasicRhinoShell
- All Implemented Interfaces:
Serializable
,org.mozilla.javascript.ConstProperties
,org.mozilla.javascript.debug.DebuggableObject
,org.mozilla.javascript.Scriptable
,org.mozilla.javascript.SymbolScriptable
Can execute scripts interactively or in batch mode at the command line. An example of controlling the JavaScript engine.
Based on Rhino.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.mozilla.javascript.ScriptableObject
org.mozilla.javascript.ScriptableObject.KeyComparator
-
Field Summary
Fields inherited from class org.mozilla.javascript.ScriptableObject
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST
Fields inherited from interface org.mozilla.javascript.Scriptable
NOT_FOUND
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
Main entry point.void
help()
Print a help message.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.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.static String[]
processOptions
(org.mozilla.javascript.Context cx, String[] args) Parse arguments.void
quit()
Quit the BasicRhinoShell.This method is defined as a JavaScript function.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.static void
warn
(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
applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkPropertyChangeForSlot, checkPropertyDefinition, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, delete, deleteProperty, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureScriptableObjectButNotSymbol, ensureSymbolScriptable, equivalentValues, get, get, get, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGeneratorFunctionPrototype, getGetterOrSetter, getGetterOrSetter, getIds, getObjectPrototype, getOwnPropertyDescriptor, getParentScope, getProperty, getProperty, getProperty, getPropertyIds, getPrototype, getSuperProperty, getSuperProperty, getSuperProperty, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, has, has, has, hasInstance, hasProperty, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, preventExtensions, put, put, put, putConst, putConstProperty, putOwnProperty, putOwnProperty, putOwnProperty, putProperty, putProperty, putProperty, putSuperProperty, putSuperProperty, putSuperProperty, querySlot, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setAttributes, setCommonDescriptorProperties, setExternalArrayData, setGetterOrSetter, setParentScope, setPrototype, size
-
Constructor Details
-
BasicRhinoShell
public BasicRhinoShell()
-
-
Method Details
-
getClassName
- Specified by:
getClassName
in interfaceorg.mozilla.javascript.Scriptable
- Specified by:
getClassName
in 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
Parse arguments.- Parameters:
cx
- the cxargs
- the args- Returns:
- the string[]
-
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
This method is defined as a JavaScript function.- Parameters:
path
- the path- Returns:
- the string
-
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
-