Class GroovyCycleFunction<T>

java.lang.Object
io.nosqlbench.adapters.api.evalctx.GroovyCycleFunction<T>
All Implemented Interfaces:
CycleFunction<T>, ExpressionDetails, VariableInjectable, LongFunction<T>
Direct Known Subclasses:
GroovyBooleanCycleFunction, GroovyObjectEqualityFunction

public class GroovyCycleFunction<T> extends Object implements CycleFunction<T>
  • Field Details

    • scriptText

      protected String scriptText
    • script

      protected final groovy.lang.Script script
    • variableBindings

      protected final groovy.lang.Binding variableBindings
    • bindingFunctions

      protected final Bindings bindingFunctions
  • Constructor Details

    • GroovyCycleFunction

      public GroovyCycleFunction(String name, String scriptText, Map<String,String> bindingSpecs, List<String> imports, List<Class<?>> staticImports, groovy.lang.Binding binding)
      Instantiate a cycle function from basic types
      Parameters:
      scriptText - The raw script text, not including any bind point or capture point syntax
      bindingSpecs - The names and recipes of bindings which are referenced in the scriptText
      imports - The package imports to be installed into the execution environment
    • GroovyCycleFunction

      public GroovyCycleFunction(String name, ParsedTemplateString template, List<String> imports, List<Class<?>> staticImports, groovy.lang.Binding binding)
  • Method Details

    • expandClassNames

      protected String[] expandClassNames(List<String> groovyImportedClasses)
    • getExpressionDetails

      public String getExpressionDetails()
      Specified by:
      getExpressionDetails in interface ExpressionDetails
    • setVariable

      public <V> void setVariable(String name, V value)
      Description copied from interface: VariableInjectable
      Set a variable by name.
      Specified by:
      setVariable in interface VariableInjectable
    • apply

      public T apply(long value)
      Description copied from interface: CycleFunction
      Produce a result from a cycle. This is an encapsulating type for any implementations which need to
      Specified by:
      apply in interface CycleFunction<T>
      Specified by:
      apply in interface LongFunction<T>
      Parameters:
      value - the function argument
      Returns:
    • newInstance

      public CycleFunction<T> newInstance()
      Create an instance of an executable function which is based on the current one, with all of the per-cycle bindings as well as the variable bindings duplicated (shared).
      Specified by:
      newInstance in interface CycleFunction<T>
      Returns: