Package com.avoka.core.groovy.runtime
Class GroovyScriptContext
- java.lang.Object
-
- com.avoka.core.groovy.runtime.GroovyScriptContext
-
public class GroovyScriptContext extends Object
Provides thread local Groovy script execution context class.- Since:
- 4.0.0
-
-
Constructor Summary
Constructors Constructor Description GroovyScriptContext(Map<String,Object> parameters)
Create a Groovy script execution object with the given parameters.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<String,Object>
getParameters()
Return the Groovy script invocation parameters.Object
getResult()
Return the Groovy script execution result object.static GroovyScriptContext
getThreadLocalContext()
Return the thread local Groovy Script execution context object.protected static int
getThreadLocalStackSize()
Return the thread local context stack size.static boolean
inGroovyConsoleScriptExecuting()
Return true if the thread stack is executing in the context of a Groovy Console scriptstatic boolean
inGroovyScriptExecuting()
Return true if the thread stack is executing in the context of a Groovy Scriptstatic boolean
isUnitTestExecuting()
Return true if the thread is executing a Unit Test scriptprotected static GroovyScriptContext
popThreadLocalContext()
Set the thread local Groovy Script execution context object.protected static GroovyScriptContext
pushThreadLocalContext(GroovyScriptContext context)
Set the thread local Groovy Script execution context object.static void
setGroovyConsoleExecution(Boolean value)
Set whether Groovy Console Script is executing.protected static void
setGroovyExecution(Boolean value)
Set whether Groovy Script is executing.void
setResult(Object result)
Set the Groovy script execution result object.static void
setUnitTestExecution(Boolean value)
Set whether a Unit Test script is executing.
-
-
-
Method Detail
-
getParameters
public Map<String,Object> getParameters()
Return the Groovy script invocation parameters.- Returns:
- the Groovy script invocation parameters
-
getResult
public Object getResult()
Return the Groovy script execution result object.- Returns:
- the Groovy script execution result object
-
setResult
public void setResult(Object result)
Set the Groovy script execution result object.- Parameters:
result
- the Groovy script execution result object
-
getThreadLocalContext
public static GroovyScriptContext getThreadLocalContext()
Return the thread local Groovy Script execution context object.- Returns:
- the thread local Groovy Script execution context object.
-
inGroovyScriptExecuting
public static boolean inGroovyScriptExecuting()
Return true if the thread stack is executing in the context of a Groovy Script- Returns:
- true if the thread stack is executing in the context of a Groovy Script
- Since:
- 4.2.0
-
inGroovyConsoleScriptExecuting
public static boolean inGroovyConsoleScriptExecuting()
Return true if the thread stack is executing in the context of a Groovy Console script- Returns:
- true if the thread stack is executing in the context of a Groovy Console script
- Since:
- 4.2.0
-
setGroovyConsoleExecution
public static void setGroovyConsoleExecution(Boolean value)
Set whether Groovy Console Script is executing.- Parameters:
value
- set whether Groovy Console Script is executing.- Since:
- 4.2.0
-
isUnitTestExecuting
public static boolean isUnitTestExecuting()
Return true if the thread is executing a Unit Test script- Returns:
- true if the thread is executing a Unit Test script
- Since:
- 4.3.0
-
setUnitTestExecution
public static void setUnitTestExecution(Boolean value)
Set whether a Unit Test script is executing.- Parameters:
value
- set whether a Unit Test script is executing- Since:
- 4.3.0
-
pushThreadLocalContext
protected static GroovyScriptContext pushThreadLocalContext(GroovyScriptContext context)
Set the thread local Groovy Script execution context object.- Parameters:
context
- the Groovy Script execution context object to set in the local thread- Returns:
- the thread local context pushed on the stack
-
popThreadLocalContext
protected static GroovyScriptContext popThreadLocalContext()
Set the thread local Groovy Script execution context object.- Parameters:
context
- the Groovy Script execution context object to set in the local thread- Returns:
- the thread local context popped off the stack
-
getThreadLocalStackSize
protected static int getThreadLocalStackSize()
Return the thread local context stack size.- Returns:
- the thread local context stack size.
-
setGroovyExecution
protected static void setGroovyExecution(Boolean value)
Set whether Groovy Script is executing.- Parameters:
value
- set whether Groovy Script is executing.- Since:
- 4.2.0
-
-