public class EvaluatorState extends Object
Evaluators to stash & 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.| Modifier and Type | Field and Description |
|---|---|
private Map<Evaluator<?>,Object> |
statePerEvaluator |
| Constructor and Description |
|---|
EvaluatorState() |
| Modifier and Type | Method and Description |
|---|---|
<T> T |
getState(Evaluator<?> evaluator,
Class<T> clazz)
Fetches state for the given evaluator, casting it into the given type
|
void |
putState(Evaluator<?> evaluator,
Object state)
Updates state for the given Evaluator
|
public <T> T getState(Evaluator<?> evaluator, Class<T> clazz)
T - type Type of the valueevaluator - the Evaluator to retrieve state forclazz - the Class to which the value should be castnull if no state has been storedCopyright © 2022 Apache NiFi Project. All rights reserved.