S - the script interfacepublic class GroovyScriptWrapper<S> extends AbstractDebuggingScriptWrapper<S>
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
MIME
The groovy scripts MIME type.
|
debugListener, parentWrapper, sessionadditionalHelpers, context, exListeners, firstException, hasCustomHelper, helper, importLines, logger, offset, optimLevel, scriptContent, source, VARIABLES_DECL_AFTER_CLASS_DECL, VARIABLES_DECL_BEFORE_CLASS_DECLMODE_BLOCKING, MODE_NON_BLOCKING, OPTIM_LEVEL_DEFAULT, OPTIM_LEVEL_MAX, OPTIM_LEVEL_MIN| Constructor and Description |
|---|
GroovyScriptWrapper() |
GroovyScriptWrapper(DebuggingWrapper<?> parentWrapper) |
| Modifier and Type | Method and Description |
|---|---|
void |
cacheInvocableMethods()
Cache the invocable methods fore the current installed script.
|
java.lang.Object |
createAdditionalScript(java.io.File file,
boolean useContext)
Create another script that can be used in the current script.
|
DebugSession<S> |
createDebugSession()
Create a debug session.
|
protected java.lang.Object |
createScriptObject(java.lang.String scriptContent)
Create the Groovy Object.
|
protected ScriptException<S> |
getCompileException(java.lang.Exception e,
java.io.File file,
java.lang.Throwable caller)
Return a proper exception from a Groovy compile-time exception, with the correct file and line number.
|
protected java.lang.String |
getDefaultContent()
Return the default content lines at the start of the script.
|
protected java.lang.String |
getDefaultDeclaration(ScriptSource source,
boolean isCallingScript)
Return the default declaration lines at the start of the script.
|
protected java.lang.String |
getDefaultImports()
Return the default import lines at the start of the script.
|
protected java.lang.String |
getEnd()
Return the lines at the end of the script.
|
java.util.Set<CachedMethodKey> |
getInvocableMethods()
Return the invocable methods for the current installed script.
|
java.util.Map<java.lang.String,java.util.Set<CachedMethodKey>> |
getInvocableMethodsByNames()
Return the invocable methods sorted by their names for the current installed script.
|
java.lang.String |
getMIME()
Return the groovy script MIME.
|
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.Object |
invokeMethod(java.lang.String name,
java.lang.Object... args)
Invoke directly a method by reflection for the current installed script.
|
boolean |
isAutoCachingInvocableMethods()
Return true if a cache of invocable methods will be created each time the wrapper installs a new script.
|
boolean |
isInvocableMethodsEnabled()
Return true because the GroovyScriptWrapper allows invocable methods are enabled for this wrapper.
|
boolean |
isLibAvailable()
Return true if the Groovy library is available.
|
boolean |
isLibAvailable(java.lang.ClassLoader loader)
Return true if the Groovy library is available.
|
boolean |
isMultiImplementSupported()
Return true.
|
boolean |
isSingletonMethodEnabled()
Return true.
|
protected boolean |
parseScript(ScriptSource source,
ScriptContent content)
Parse the script content.
|
void |
setAutoCacheInvocableMethods(boolean autoCache)
Set if a cache of invocable methods will be created each time the wrapper installs a new script.
|
__step__, endDebugSession, err, getDebugListener, getDebugSession, getLineNumber, getLineNumber, getParentWrapper, getPreferredLogger, initializeDebugSession, isDebugging, isInDebugSession, setDebugListenerabort, addActiveScript, addAdditionalHelper, addExceptionListener, addImports, addImports, addImports, addUncompiledScript, clearActiveScriptFiles, clearAdditionalHelpers, clearImports, convertPrimitiveArgument, countImportLines, createScriptContext, createScriptObject, getActiveEncodedScriptFile, getActiveScriptFile, getActiveScripts, getActiveScriptSource, getAdditionalHelpers, getAdditionalScriptContent, getClassLoader, getCompileException, getContextClassPath, getCustomImports, getExceptionListeners, getExecutionMode, getFilename, getHelperClassPath, getInvocableMethodKey, getLoggerClassPath, getOffset, getOptimizationLevel, getRawScript, getRuntimeException, getRuntimeException, getScriptClassName, getScriptContent, getScriptContext, getScriptFile, getScriptInterface, getScriptProxy, getSingletonMethod, getSource, getVariablesDeclarationsPosition, hasActiveScriptFile, hasAdditionalHelpers, hasScriptHelper, hasSingletonMethod, installScript, installScript, installScript, installScript, isLoggingExceptions, logExceptions, notifyExceptionToListeners, reInstallScript, reInstallScript, reInstallScript, removeExceptionListener, removeTabulations, setClassLoader, setExecutionMode, setOptimizationLevel, setScriptContext, setScriptLogger, startMethodclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitisDebugSupportedabort, abort, addAdditionalHelper, addExceptionListener, addImports, addImports, addImports, clearAdditionalHelpers, clearImports, countImportLines, createAdditionalScript, err, getActiveEncodedScriptFile, getActiveScriptFile, getActiveScripts, getActiveScriptSource, getAdditionalHelpers, getClassLoader, getExceptionListeners, getExecutionMode, getFilename, getOffset, getOptimizationLevel, getRawScript, getScript, getScriptClassName, getScriptContent, getScriptContext, getScriptFile, getScriptInterface, getScriptProxy, getScriptProxy, getScriptProxyHandler, getSource, hasActiveScriptFile, hasAdditionalHelpers, hasScriptHelper, hasSingletonMethod, installScript, installScript, installScript, installScript, installScript, installScript, installScript, installScript, isLoggingExceptions, logExceptions, reInstallScript, removeExceptionListener, resetWrapperState, setClassLoader, setExecutionMode, setOptimizationLevel, setScriptContext, setScriptLogger, startMethodhasInvocableMethod, invokeMethod, isInvocableByNamepublic static final java.lang.String MIME
public GroovyScriptWrapper(DebuggingWrapper<?> parentWrapper)
public GroovyScriptWrapper()
public boolean isLibAvailable()
public boolean isLibAvailable(java.lang.ClassLoader loader)
loader - the Classloaderpublic java.lang.String getMIME()
public java.lang.String getScriptExtension()
protected java.lang.String getDefaultImports()
getDefaultImports in class AbstractScriptWrapper<S>protected java.lang.String getDefaultDeclaration(ScriptSource source, boolean isCallingScript)
getDefaultDeclaration in class AbstractScriptWrapper<S>isCallingScript - true for the calling scriptsource - the script sourceprotected java.lang.String getEnd()
getEnd in class AbstractScriptWrapper<S>protected java.lang.String getDefaultContent()
getDefaultContent in class AbstractScriptWrapper<S>public boolean isMultiImplementSupported()
public boolean isSingletonMethodEnabled()
public boolean isInvocableMethodsEnabled()
public boolean isAutoCachingInvocableMethods()
public void setAutoCacheInvocableMethods(boolean autoCache)
autoCache - true if a cache of invocable methods will be created each time the wrapper installs a new scriptpublic void cacheInvocableMethods()
public java.util.Set<CachedMethodKey> getInvocableMethods()
public java.util.Map<java.lang.String,java.util.Set<CachedMethodKey>> getInvocableMethodsByNames()
public java.lang.Object invokeMethod(java.lang.String name,
java.lang.Object... args)
name - the method nameargs - the method argumentspublic DebugSession<S> createDebugSession() throws java.lang.Exception
createDebugSession in interface DebuggingWrapper<S>createDebugSession in class AbstractDebuggingScriptWrapper<S>java.lang.Exceptionpublic java.lang.Object createAdditionalScript(java.io.File file,
boolean useContext)
throws ScriptRuntimeException
ScriptWrapperfile - the script fileuseContext - true if the additional script must use the contextScriptRuntimeException - if the script could not be created (the file may not exist, or the syntax is invalid)protected java.lang.Object createScriptObject(java.lang.String scriptContent)
throws java.lang.Exception
createScriptObject in class AbstractScriptWrapper<S>scriptContent - the content to use for the script creationjava.lang.Exception - if the object could not be created. Usually it means that the script content is not a
valid Groovy scriptprotected boolean parseScript(ScriptSource source, ScriptContent content)
AbstractScriptWrapperparseScript in class AbstractScriptWrapper<S>source - the script sourcecontent - the content objectpublic ScriptException<S> getScriptException(java.lang.Throwable th)
ScriptWrapperth - the Throwableprotected ScriptException<S> getCompileException(java.lang.Exception e, java.io.File file, java.lang.Throwable caller)
getCompileException in class AbstractScriptWrapper<S>e - the initial Exceptionfile - the file from which the exception originatescaller - the callerCopyright © 2019-2025 Herve Girod. All Rights Reserved. Documentation and source under the BSD licence