Package org.zaproxy.zap.extension.script
Class ScriptEngineWrapper
- java.lang.Object
-
- org.zaproxy.zap.extension.script.ScriptEngineWrapper
-
- Direct Known Subclasses:
DefaultEngineWrapper
public abstract class ScriptEngineWrapper extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description ScriptEngineWrapper(javax.script.ScriptEngine engine)
Deprecated.(2.8.0) UseScriptEngineWrapper(ScriptEngineFactory)
instead.ScriptEngineWrapper(javax.script.ScriptEngineFactory factory)
Constructs aScriptEngineWrapper
with the given engine factory.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description javax.script.ScriptEngine
getEngine()
java.lang.String
getEngineName()
java.util.List<java.lang.String>
getExtensions()
abstract javax.swing.ImageIcon
getIcon()
java.lang.String
getLanguageName()
abstract java.lang.String
getSyntaxStyle()
abstract java.lang.String
getTemplate(java.lang.String type)
abstract boolean
isDefaultTemplate(ScriptWrapper script)
Tells whether or not the givenscript
is a default template of this engine.abstract boolean
isRawEngine()
boolean
isSingleThreaded()
Tells whether or not this engine is single threaded.abstract boolean
isSupportsMissingTemplates()
Returns true if this engine supports script types without defined templates.abstract boolean
isTextBased()
boolean
isVisible()
Tells whether or not this engine should be visible to the user.
-
-
-
Constructor Detail
-
ScriptEngineWrapper
@Deprecated public ScriptEngineWrapper(javax.script.ScriptEngine engine)
Deprecated.(2.8.0) UseScriptEngineWrapper(ScriptEngineFactory)
instead.Constructs aScriptEngineWrapper
with the given engine (to obtain a factory).- Parameters:
engine
- an engine to obtain the correspondingScriptEngineFactory
.
-
ScriptEngineWrapper
public ScriptEngineWrapper(javax.script.ScriptEngineFactory factory)
Constructs aScriptEngineWrapper
with the given engine factory.- Parameters:
factory
- the factory to createScriptEngine
s and obtain engine data (for example, engine name, language).- Since:
- 2.8.0
- See Also:
getEngine()
-
-
Method Detail
-
getLanguageName
public java.lang.String getLanguageName()
-
getEngineName
public java.lang.String getEngineName()
-
getEngine
public javax.script.ScriptEngine getEngine()
-
isTextBased
public abstract boolean isTextBased()
-
getTemplate
public abstract java.lang.String getTemplate(java.lang.String type)
-
getSyntaxStyle
public abstract java.lang.String getSyntaxStyle()
-
getIcon
public abstract javax.swing.ImageIcon getIcon()
-
getExtensions
public java.util.List<java.lang.String> getExtensions()
-
isSingleThreaded
public boolean isSingleThreaded()
Tells whether or not this engine is single threaded.Engines that are single threaded have their cached scripts executed by a single thread at a time.
- Returns:
true
if the engine is single threaded,false
otherwise.- Since:
- 2.12.0
- See Also:
ScriptsCache
-
isVisible
public boolean isVisible()
Tells whether or not this engine should be visible to the user.Engines that are not visible are not shown in the GUI nor listed through the API.
Engines are visible by default.
- Returns:
true
if the engine should be visible to the user,false
otherwise.- Since:
- 2.8.0
-
isRawEngine
public abstract boolean isRawEngine()
-
isSupportsMissingTemplates
public abstract boolean isSupportsMissingTemplates()
Returns true if this engine supports script types without defined templates.- Returns:
true
if the engine doesn't require templates,false
otherwise.
-
isDefaultTemplate
public abstract boolean isDefaultTemplate(ScriptWrapper script)
Tells whether or not the givenscript
is a default template of this engine.Default templates are automatically removed when the script engine is removed.
- Parameters:
script
- the script template that should be checked- Returns:
true
if the template script is default of this engine,false
otherwise
-
-