java.lang.Object
org.mozilla.javascript.ScriptableObject
net.alchim31.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
The BasicRhinoShell program.

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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    exec(String[] args, org.mozilla.javascript.ErrorReporter reporter)
    Main entry point.
     
    void
    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 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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • BasicRhinoShell

      public BasicRhinoShell()
  • Method Details

    • getClassName

      public String getClassName()
      Specified by:
      getClassName in interface org.mozilla.javascript.Scriptable
      Specified by:
      getClassName in class org.mozilla.javascript.ScriptableObject
    • exec

      public static void exec(String[] args, org.mozilla.javascript.ErrorReporter reporter)
      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 args
      reporter - the reporter
    • processOptions

      public static String[] processOptions(org.mozilla.javascript.Context cx, String[] args)
      Parse arguments.
      Parameters:
      cx - the cx
      args - 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 cx
      thisObj - the this obj
      args - the args
      funObj - 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 cx
      thisObj - the this obj
      args - the args
      funObj - the fun obj
    • readFile

      public String readFile(String path)
      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 cx
      thisObj - the this obj
      args - the args
      funObj - 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 cx
      thisObj - the this obj
      args - the args
      funObj - the fun obj