S
- the script interfacepublic interface ScriptWrapper<S> extends ScriptMethodInvoker
Modifier and Type | Field and Description |
---|---|
static short |
MODE_BLOCKING
The default mode, for blocking Wrappers.
|
static short |
MODE_NON_BLOCKING
The mode for non blocking Wrappers.
|
static java.lang.String |
OPTIM_LEVEL_DEFAULT
"default": The default optimization level.
|
static java.lang.String |
OPTIM_LEVEL_MAX
"maximum": The maximum optimization level.
|
static java.lang.String |
OPTIM_LEVEL_MIN
"minimum": The minimum optimization level.
|
Modifier and Type | Method and Description |
---|---|
default void |
__step__(java.lang.Object... args)
Fired when entering a step in debug.
|
default void |
addAdditionalHelper(java.lang.String name,
java.lang.Object helper)
Add an additional helper instance which will be usable in the script.
|
void |
addExceptionListener(ScriptExceptionListener listener)
Add a listener which will be fired for script exceptions.
|
void |
addImports(java.lang.Class<?>... imports)
Set additional custom import declarations for the scripts.
|
void |
addImports(java.util.Set<java.lang.String> imports)
Add additional custom import declarations for the scripts.
|
void |
addImports(java.lang.String... imports)
Add additional custom import declarations for the scripts.
|
default void |
clearAdditionalHelpers()
Clear the additional helper instances.
|
void |
clearImports()
Clear the import declarations.
|
int |
countImportLines()
Return the number of import lines.
|
void |
err(java.lang.String message,
char errorType,
java.lang.Throwable e)
Log an error.
|
default void |
err(java.lang.String message,
java.lang.Throwable e)
Log an error, with a
ErrorType.RUNTIME error type. |
default java.util.Map<java.lang.String,java.lang.Object> |
getAdditionalHelpers()
Return the additional helper instances.
|
java.lang.ClassLoader |
getClassLoader()
Return the ClassLoader.
|
java.util.List<ScriptExceptionListener> |
getExceptionListeners()
Return the listeners which will be fired for script exceptions.
|
short |
getExecutionMode()
Return the execution mode.
|
java.lang.String |
getFilename()
Return the script filename.
|
default int |
getLineNumber(int lineNumber)
Return the effective line number of a line detected in the script runtime.
|
default int |
getLineNumber(int lineNumber,
boolean isException)
Return the effective line number of a line detected in the script runtime.
|
java.lang.String |
getMIME()
Return the script MIME.
|
int |
getOffset()
Return the script offset after the import lines.
|
default java.lang.String |
getOptimizationLevel()
Return the default optimization level.
|
S |
getRawScript()
Return the raw script.
|
default S |
getScript()
Return the script proxy.
|
java.lang.String |
getScriptClassName()
Return the class name of the script.
|
java.lang.String |
getScriptContent()
Return the script text content.
|
ScriptContext |
getScriptContext()
Return the script context.
|
ScriptException<S> |
getScriptException(java.lang.Throwable th)
Create a Script exception from a Throwable.
|
java.lang.String |
getScriptExtension()
Return the script file extension.
|
java.lang.Class<S> |
getScriptInterface()
Return the class of the script interface.
|
default ScriptProxy<S> |
getScriptProxy()
Return the script proxy.
|
ScriptProxy<S> |
getScriptProxy(S script)
Return the script proxy, for a specified script.
|
default ScriptProxy<S> |
getScriptProxyHandler()
Return the script proxy.
|
ScriptSource |
getSource()
Return the script source.
|
default boolean |
hasAdditionalHelpers()
Return true the there are additional helper instances.
|
boolean |
hasScriptHelper()
Return true if there is a script helper.
|
default boolean |
hasSingletonMethod()
Return true if there is a singleton method.
|
default S |
installScript(java.io.File file)
Install the script, using the current context ClassLoader.
|
S |
installScript(java.io.File file,
java.lang.ClassLoader loader)
Install the script.
|
default S |
installScript(ScriptSource source)
Install the script, using the current context ClassLoader.
|
S |
installScript(ScriptSource source,
java.lang.ClassLoader loader)
Install the script.
|
default S |
installScript(java.lang.String content)
Install the script, using the current context ClassLoader.
|
default S |
installScript(java.lang.String content,
java.lang.ClassLoader loader)
Install the script.
|
default S |
installScript(java.net.URL url)
Install the script, using the current context ClassLoader.
|
default S |
installScript(java.net.URL url,
java.lang.ClassLoader loader)
Install the script.
|
default boolean |
isDebugging()
Return true if the wrapper is in a debug session and debugging.
|
default boolean |
isDebugSupported()
Return true is debugging is supported.
|
default boolean |
isInDebugSession()
Return true if the wrapper is in a debug session.
|
default boolean |
isLibAvailable()
Return true if the script library is available.
|
default boolean |
isLibAvailable(java.lang.ClassLoader loader)
Return true if the script library is available.
|
default boolean |
isLoggingExceptions()
Return true if the wrapper must log exceptions (default is false).
|
default boolean |
isMultiImplementSupported()
Return true if the Scripting language implementation support the implementation of multiple interfaces.
|
default boolean |
isSingletonMethodEnabled()
Return true if the Scripting language implementation support defining a script without any method.
|
default void |
logExceptions(boolean isLoggingExceptions)
Set if the wrapper must log exceptions.
|
S |
reInstallScript()
Reinstall an already installed script.
|
boolean |
removeExceptionListener(ScriptExceptionListener listener)
Remove a previously added exception listener.
|
default void |
resetWrapperState()
Reset the wrapper state.
|
void |
setClassLoader(java.lang.ClassLoader loader)
Set the ClassLoader.
|
void |
setExecutionMode(short mode)
Set the execution mode.
|
default void |
setOptimizationLevel(java.lang.String optimLevel)
Set the optimization level.
|
void |
setScriptContext(ScriptContext context)
Set the script context.
|
void |
setScriptLogger(ScriptLogger logger)
Set the script logger.
|
void |
startMethod()
Start a script method.
|
cacheInvocableMethods, getInvocableMethods, getInvocableMethodsByNames, hasInvocableMethod, invokeMethod, invokeMethod, isAutoCachingInvocableMethods, isInvocableByName, isInvocableMethodsEnabled, setAutoCacheInvocableMethods
static final short MODE_BLOCKING
static final short MODE_NON_BLOCKING
static final java.lang.String OPTIM_LEVEL_DEFAULT
static final java.lang.String OPTIM_LEVEL_MIN
static final java.lang.String OPTIM_LEVEL_MAX
default boolean isLibAvailable()
default boolean isLibAvailable(java.lang.ClassLoader loader)
loader
- the Classloaderjava.lang.String getMIME()
void setExecutionMode(short mode)
mode
- the execution modeshort getExecutionMode()
default java.lang.String getOptimizationLevel()
default void setOptimizationLevel(java.lang.String optimLevel)
optimLevel
- the optimization levelvoid setClassLoader(java.lang.ClassLoader loader)
loader
- the ClassLoaderjava.lang.ClassLoader getClassLoader()
default boolean isMultiImplementSupported()
default boolean isSingletonMethodEnabled()
default boolean hasSingletonMethod()
void addExceptionListener(ScriptExceptionListener listener)
listener
- the listenerjava.util.List<ScriptExceptionListener> getExceptionListeners()
boolean removeExceptionListener(ScriptExceptionListener listener)
listener
- the listenervoid setScriptContext(ScriptContext context)
context
- the script contextScriptContext getScriptContext()
boolean hasScriptHelper()
java.lang.String getScriptContent()
S getRawScript()
getScript()
instead if you want to be able to catch exceptions.default S getScript()
getScriptProxy()
. Exceptions will be catched by the
ScriptExceptionListener
s if isLoggingExceptions()
returns true.default ScriptProxy<S> getScriptProxyHandler()
getScriptProxy()
. Exceptions will be catched by the
ScriptExceptionListener
s if isLoggingExceptions()
returns true.default ScriptProxy<S> getScriptProxy()
ScriptExceptionListener
s if
isLoggingExceptions()
returns true.ScriptProxy<S> getScriptProxy(S script)
script
- the scriptjava.lang.Class<S> getScriptInterface()
java.lang.String getScriptClassName()
ScriptSource getSource()
java.lang.String getFilename()
void addImports(java.lang.Class<?>... imports)
imports
- the additional custom import declarationsvoid addImports(java.util.Set<java.lang.String> imports)
imports
- the additional custom import declarationsvoid addImports(java.lang.String... imports)
imports
- the additional custom import declarationsvoid clearImports()
default void addAdditionalHelper(java.lang.String name, java.lang.Object helper)
name
- the helper instance namehelper
- the helper instancedefault java.util.Map<java.lang.String,java.lang.Object> getAdditionalHelpers()
default boolean hasAdditionalHelpers()
default void clearAdditionalHelpers()
int getOffset()
int countImportLines()
default int getLineNumber(int lineNumber)
lineNumber
- the line numberdefault int getLineNumber(int lineNumber, boolean isException)
lineNumber
- the line numberisException
- true for getting the line number for an exceptionjava.lang.String getScriptExtension()
ScriptException<S> getScriptException(java.lang.Throwable th)
th
- the Throwablevoid setScriptLogger(ScriptLogger logger)
logger
- the script loggerdefault S installScript(java.net.URL url)
url
- the script urldefault S installScript(java.io.File file)
file
- the script filedefault S installScript(java.lang.String content)
content
- the script contentdefault S installScript(ScriptSource source)
source
- the script sourceS reInstallScript()
default boolean isDebugging()
default boolean isInDebugSession()
default boolean isDebugSupported()
default void __step__(java.lang.Object... args)
args
- the argumentsdefault S installScript(java.net.URL url, java.lang.ClassLoader loader)
url
- the script URLloader
- the ClassLoaderS installScript(java.io.File file, java.lang.ClassLoader loader)
file
- the script fileloader
- the ClassLoaderdefault S installScript(java.lang.String content, java.lang.ClassLoader loader)
content
- the script contentloader
- the ClassLoaderS installScript(ScriptSource source, java.lang.ClassLoader loader)
source
- the script sourceloader
- the ClassLoadervoid startMethod()
default void resetWrapperState()
startMethod()
by default.default void logExceptions(boolean isLoggingExceptions)
isLoggingExceptions
- true if the wrapper must log exceptionsdefault boolean isLoggingExceptions()
default void err(java.lang.String message, java.lang.Throwable e)
ErrorType.RUNTIME
error type.message
- the error messagee
- the Throwablevoid err(java.lang.String message, char errorType, java.lang.Throwable e)
message
- the error messageerrorType
- the error typee
- the ThrowableErrorType
Copyright © 2019-2024 Herve Girod. All Rights Reserved. Documentation and source under the BSD licence