java.lang.Object
org.apache.nifi.attribute.expression.language.evaluation.EvaluatorState

public class EvaluatorState extends Object
A storage mechanism for Evaluators to stash invalid input: '&' retrieve state. While most Evaluators are stateless, some must maintain state, for instance to iterate over many Attributes. By stashing that state and retrieving it from this EvaluatorState instead of using member variables, Evaluators are able to be kept both threadsafe and in-and-of-themselves stateless, which means that new Evaluators need not be created for each iteration of the function.
  • Field Details

  • Constructor Details

    • EvaluatorState

      public EvaluatorState()
  • Method Details

    • getState

      public <T> T getState(Evaluator<?> evaluator, Class<T> clazz)
      Fetches state for the given evaluator, casting it into the given type
      Type Parameters:
      T - type Type of the value
      Parameters:
      evaluator - the Evaluator to retrieve state for
      clazz - the Class to which the value should be cast
      Returns:
      the state for the given Evaluator, or null if no state has been stored
    • putState

      public void putState(Evaluator<?> evaluator, Object state)
      Updates state for the given Evaluator
      Parameters:
      evaluator - the Evaluator to store state for
      state - the state to store