Class LazyEvaluator<T>

java.lang.Object
io.sentry.util.LazyEvaluator<T>

@Internal public final class LazyEvaluator<T> extends Object
Class that evaluates a function lazily. It means the evaluator function is called only when getValue is called, and it's cached.
  • Constructor Details

    • LazyEvaluator

      public LazyEvaluator(@NotNull @NotNull LazyEvaluator.Evaluator<T> evaluator)
      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

      @NotNull public T 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

      public void setValue(@Nullable T value)
    • resetValue

      public void resetValue()
      Resets the internal value and forces the evaluator function to be called the next time getValue() is called.