Package org.codelibs.maven.yuicompressor
Class BasicRhinoShell
java.lang.Object
org.mozilla.javascript.ScriptableObject
org.codelibs.maven.yuicompressor.BasicRhinoShell
- All Implemented Interfaces:
Serializable,org.mozilla.javascript.ConstProperties,org.mozilla.javascript.debug.DebuggableObject,org.mozilla.javascript.Scriptable,org.mozilla.javascript.SymbolScriptable
public class BasicRhinoShell
extends org.mozilla.javascript.ScriptableObject
Basic Rhino Shell for executing JavaScript.
Can execute scripts interactively or in batch mode at the command line. Based on Mozilla Rhino's BasicRhinoShell example.
- Author:
- Norris Boyd, David Bernard, CodeLibs Project
- 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_CONSTFields inherited from interface org.mozilla.javascript.Scriptable
NOT_FOUND -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidMain entry point for executing JavaScript.voidhelp()Display help message.static voidload(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable thisObj, Object[] args, org.mozilla.javascript.Function funObj) Load and execute 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 arguments.static String[]processOptions(org.mozilla.javascript.Context cx, String[] args) Parse and process command line options.voidquit()Quit the shell (only affects interactive mode).Read a file and return its contents as a string.static doubleversion(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable thisObj, Object[] args, org.mozilla.javascript.Function funObj) Get and set the JavaScript language version.static voidwarn(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable thisObj, Object[] args, org.mozilla.javascript.Function funObj) Report a warning.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:
getClassNamein interfaceorg.mozilla.javascript.Scriptable- Specified by:
getClassNamein classorg.mozilla.javascript.ScriptableObject
-
exec
Main entry point for executing JavaScript.Process arguments and set up the execution environment.
- Parameters:
args- command line argumentsreporter- error reporter for JavaScript errors
-
processOptions
Parse and process command line options.- Parameters:
cx- the JavaScript contextargs- command line arguments- Returns:
- remaining arguments after options are processed
-
help
public void help()Display 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 arguments.This method is defined as a JavaScript function.
-
quit
public void quit()Quit the shell (only affects 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) Report a warning.This method is defined as a JavaScript function.
-
readFile
Read a file and return its contents as a string.This method is defined as a JavaScript function.
- Parameters:
path- the file path- Returns:
- file contents
- Throws:
RuntimeException- if file cannot be read
-
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 JavaScript language version.This method is defined as a JavaScript function.
-
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 JavaScript source files.This method is defined as a JavaScript function.
-