Class ScriptEngineOptions


  • public class ScriptEngineOptions
    extends com.ibm.jscript.JSContext
    This class configures the IBM JS script engine. Since 2.2 The isDebugAllowed is now final static so setDebugAllowed were removed to comply with the new JSContext interface. Since 2.0 ScriptEngineOptions is no longer just an options class. It also provides the isDebugAllowed() method that is different for each instance of the engine. Although this could be a static hastable with reference to the current thread, the overhead of allocating a new JSContext is fairly small since we don't use the script caching features of the JSContext.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static interface  ScriptEngineOptions.TDIDebugListener  
      • Nested classes/interfaces inherited from class com.ibm.jscript.JSContext

        com.ibm.jscript.JSContext.ILibrary, com.ibm.jscript.JSContext.LibraryInitializer, com.ibm.jscript.JSContext.PropertyResolver
    • Field Summary

      • Fields inherited from class com.ibm.jscript.JSContext

        ENABLE_JSDEBUGGER
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addDebugListener​(ScriptEngineOptions.TDIDebugListener listener)  
      boolean autoConvertJavaArgsToString()  
      static void clearNoClassSet()
      Clear the set containing strings that are not classes.
      void debugStatement​(com.ibm.jscript.ASTTree.ASTNode statement, com.ibm.jscript.engine.IExecutionContext context)
      Called by ASTDebug
      static com.ibm.jscript.JSContext get()
      Returns a context with no debugging and cache disabled
      static com.ibm.jscript.JSContext get​(boolean debug)
      Returns a context with debugging enabled and cache disabled
      java.beans.BeanInfo getBeanInfo​(java.lang.Class<?> clazz)  
      com.ibm.jscript.IValue getProperty​(java.lang.Object object, java.lang.String propertyName)
      int getSourceTabSize()  
      boolean hasGlobalObjectExtensions()  
      boolean hasJavaBeanAccess()  
      boolean hasJUnitExtensions()  
      boolean hasListOperator()  
      boolean hasMathExtensions()  
      boolean hasObjectPrototypeExtensions()  
      boolean hasRhinoExtensions()  
      boolean hasStringExtendedMethods()  
      boolean hasStringLengthAsMethod()  
      boolean ignoreJavaCallAmbiguities()  
      boolean isDebug()  
      java.lang.Class loadClass​(java.lang.String className)
      Overrides the default loadClass, to remember strings that are not classes.
      boolean putProperty​(java.lang.Object object, java.lang.String propertyName, com.ibm.jscript.IValue value)
      void removeDebugListener​(ScriptEngineOptions.TDIDebugListener listener)  
      com.ibm.jscript.types.JavaWrapperObject wrapObject​(java.lang.Object o)
      • Methods inherited from class com.ibm.jscript.JSContext

        addDesignTimeClassLoader, createExpression, createExpression, evaluateConstant, evaluateConstantAsString, getAccessControlContext, getASTProgram, getCachedExpression, getClassInfo, getDesignTimeClassLoaders, getExpression, getExpression, getExpression, getExpression, getExpression, getExpression, getExpressionCache, getJsonFactory, getLibraryInitializer, getPropertyResolver, getRegistry, getStandardStream, getStaticContext, getTempExecutionContext, getVersion, hasDefaultListOp, hasExpressionCache, hasJavaBridge, hasJSLibrary, hasRhinoProtoExtensions, includeCallerFunctionContext, init, isDebugAllowed, isJavaConstructorAllowed, isJavaFieldAllowed, isJavaMethodAllowed, isJavaPropertyAllowed, isRuntimeOptimized, loadLibrary, parseScript, print, println, putCachedExpression, putClassInfo, setJsonFactory, setLibraryInitializer, setPropertyResolver, setVersion, useGeneratedWrappers
      • Methods inherited from class java.lang.Object

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

      • ScriptEngineOptions

        public ScriptEngineOptions()
      • ScriptEngineOptions

        public ScriptEngineOptions​(boolean useCache,
                                   boolean debug)
    • Method Detail

      • get

        public static com.ibm.jscript.JSContext get()
        Returns a context with no debugging and cache disabled
        Returns:
        a context.
      • get

        public static com.ibm.jscript.JSContext get​(boolean debug)
        Returns a context with debugging enabled and cache disabled
        Returns:
        a context.
      • isDebug

        public boolean isDebug()
      • debugStatement

        public void debugStatement​(com.ibm.jscript.ASTTree.ASTNode statement,
                                   com.ibm.jscript.engine.IExecutionContext context)
                            throws com.ibm.jscript.JavaScriptException
        Called by ASTDebug
        Parameters:
        statement - The statement about to be executed
        context - The context in which the statement executes
        Throws:
        com.ibm.jscript.JavaScriptException
      • hasStringLengthAsMethod

        public boolean hasStringLengthAsMethod()
        Overrides:
        hasStringLengthAsMethod in class com.ibm.jscript.JSContext
        Returns:
        true
      • hasStringExtendedMethods

        public boolean hasStringExtendedMethods()
        Overrides:
        hasStringExtendedMethods in class com.ibm.jscript.JSContext
        Returns:
        true
      • hasGlobalObjectExtensions

        public boolean hasGlobalObjectExtensions()
        Overrides:
        hasGlobalObjectExtensions in class com.ibm.jscript.JSContext
        Returns:
        true
      • hasJUnitExtensions

        public boolean hasJUnitExtensions()
        Overrides:
        hasJUnitExtensions in class com.ibm.jscript.JSContext
        Returns:
        false
      • hasObjectPrototypeExtensions

        public boolean hasObjectPrototypeExtensions()
        Overrides:
        hasObjectPrototypeExtensions in class com.ibm.jscript.JSContext
        Returns:
        true
      • hasMathExtensions

        public boolean hasMathExtensions()
        Overrides:
        hasMathExtensions in class com.ibm.jscript.JSContext
        Returns:
        true
      • hasListOperator

        public boolean hasListOperator()
        Returns:
        false
      • hasRhinoExtensions

        public boolean hasRhinoExtensions()
        Overrides:
        hasRhinoExtensions in class com.ibm.jscript.JSContext
        Returns:
        true
      • hasJavaBeanAccess

        public boolean hasJavaBeanAccess()
        Overrides:
        hasJavaBeanAccess in class com.ibm.jscript.JSContext
        Returns:
        true
      • autoConvertJavaArgsToString

        public boolean autoConvertJavaArgsToString()
        Overrides:
        autoConvertJavaArgsToString in class com.ibm.jscript.JSContext
        Returns:
        true
      • ignoreJavaCallAmbiguities

        public boolean ignoreJavaCallAmbiguities()
        Overrides:
        ignoreJavaCallAmbiguities in class com.ibm.jscript.JSContext
        Returns:
        true
      • getProperty

        public com.ibm.jscript.IValue getProperty​(java.lang.Object object,
                                                  java.lang.String propertyName)
                                           throws com.ibm.jscript.InterpretException
        Overrides:
        getProperty in class com.ibm.jscript.JSContext
        Throws:
        com.ibm.jscript.InterpretException
      • getBeanInfo

        public java.beans.BeanInfo getBeanInfo​(java.lang.Class<?> clazz)
                                        throws java.beans.IntrospectionException
        Overrides:
        getBeanInfo in class com.ibm.jscript.JSContext
        Throws:
        java.beans.IntrospectionException
      • putProperty

        public boolean putProperty​(java.lang.Object object,
                                   java.lang.String propertyName,
                                   com.ibm.jscript.IValue value)
                            throws com.ibm.jscript.InterpretException
        Overrides:
        putProperty in class com.ibm.jscript.JSContext
        Throws:
        com.ibm.jscript.InterpretException
      • wrapObject

        public com.ibm.jscript.types.JavaWrapperObject wrapObject​(java.lang.Object o)
        Overrides:
        wrapObject in class com.ibm.jscript.JSContext
      • loadClass

        public java.lang.Class loadClass​(java.lang.String className)
                                  throws java.lang.ClassNotFoundException
        Overrides the default loadClass, to remember strings that are not classes.
        Overrides:
        loadClass in class com.ibm.jscript.JSContext
        Throws:
        java.lang.ClassNotFoundException
      • clearNoClassSet

        public static void clearNoClassSet()
        Clear the set containing strings that are not classes. This method is useful to call after adding new jars to the class loader.
      • getSourceTabSize

        public int getSourceTabSize()
        Overrides:
        getSourceTabSize in class com.ibm.jscript.JSContext