Package io.sentry.util
Class LazyEvaluator<T>
java.lang.Object
io.sentry.util.LazyEvaluator<T>
Class that evaluates a function lazily. It means the evaluator function is called only when
getValue is called, and it's cached.
-
Nested Class Summary
-
Constructor Summary
ConstructorDescriptionLazyEvaluator
(@NotNull LazyEvaluator.Evaluator<T> evaluator) Class that evaluates a function lazily. -
Method Summary
Modifier and TypeMethodDescriptiongetValue()
Executes the evaluator function and caches its result, so that it's called only once, unless resetValue is called.void
Resets the internal value and forces the evaluator function to be called the next time getValue() is called.void
-
Constructor Details
-
LazyEvaluator
Class that evaluates a function lazily. It means the evaluator function is called only when getValue is called, and it's cached.- Parameters:
evaluator
- The function to evaluate.
-
-
Method Details
-
getValue
Executes the evaluator function and caches its result, so that it's called only once, unless resetValue is called.- Returns:
- The result of the evaluator function.
-
setValue
-
resetValue
public void resetValue()Resets the internal value and forces the evaluator function to be called the next time getValue() is called.
-