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 Details

    • GroovyScriptContext

      public GroovyScriptContext(Map<String,Object> parameters)
      Create a Groovy script execution object with the given parameters.
      Parameters:
      parameters - the Groovy script invocation parameters
  • Method Details

    • 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