Package com.ibm.di.script
Class ScriptEngineOptions
- java.lang.Object
-
- com.ibm.jscript.JSContext
-
- com.ibm.di.script.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
-
Constructor Summary
Constructors Constructor Description ScriptEngineOptions()
ScriptEngineOptions(boolean useCache, boolean debug)
-
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 ASTDebugstatic com.ibm.jscript.JSContext
get()
Returns a context with no debugging and cache disabledstatic com.ibm.jscript.JSContext
get(boolean debug)
Returns a context with debugging enabled and cache disabledjava.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
-
-
-
-
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.
-
addDebugListener
public void addDebugListener(ScriptEngineOptions.TDIDebugListener listener)
-
removeDebugListener
public void removeDebugListener(ScriptEngineOptions.TDIDebugListener listener)
-
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 executedcontext
- The context in which the statement executes- Throws:
com.ibm.jscript.JavaScriptException
-
hasStringLengthAsMethod
public boolean hasStringLengthAsMethod()
- Overrides:
hasStringLengthAsMethod
in classcom.ibm.jscript.JSContext
- Returns:
- true
-
hasStringExtendedMethods
public boolean hasStringExtendedMethods()
- Overrides:
hasStringExtendedMethods
in classcom.ibm.jscript.JSContext
- Returns:
- true
-
hasGlobalObjectExtensions
public boolean hasGlobalObjectExtensions()
- Overrides:
hasGlobalObjectExtensions
in classcom.ibm.jscript.JSContext
- Returns:
- true
-
hasJUnitExtensions
public boolean hasJUnitExtensions()
- Overrides:
hasJUnitExtensions
in classcom.ibm.jscript.JSContext
- Returns:
- false
-
hasObjectPrototypeExtensions
public boolean hasObjectPrototypeExtensions()
- Overrides:
hasObjectPrototypeExtensions
in classcom.ibm.jscript.JSContext
- Returns:
- true
-
hasMathExtensions
public boolean hasMathExtensions()
- Overrides:
hasMathExtensions
in classcom.ibm.jscript.JSContext
- Returns:
- true
-
hasListOperator
public boolean hasListOperator()
- Returns:
- false
-
hasRhinoExtensions
public boolean hasRhinoExtensions()
- Overrides:
hasRhinoExtensions
in classcom.ibm.jscript.JSContext
- Returns:
- true
-
hasJavaBeanAccess
public boolean hasJavaBeanAccess()
- Overrides:
hasJavaBeanAccess
in classcom.ibm.jscript.JSContext
- Returns:
- true
-
autoConvertJavaArgsToString
public boolean autoConvertJavaArgsToString()
- Overrides:
autoConvertJavaArgsToString
in classcom.ibm.jscript.JSContext
- Returns:
- true
-
ignoreJavaCallAmbiguities
public boolean ignoreJavaCallAmbiguities()
- Overrides:
ignoreJavaCallAmbiguities
in classcom.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 classcom.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 classcom.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 classcom.ibm.jscript.JSContext
- Throws:
com.ibm.jscript.InterpretException
-
wrapObject
public com.ibm.jscript.types.JavaWrapperObject wrapObject(java.lang.Object o)
- Overrides:
wrapObject
in classcom.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 classcom.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 classcom.ibm.jscript.JSContext
-
-