Class HookRunner

java.lang.Object
com.launchdarkly.sdk.android.HookRunner

public class HookRunner extends Object
  • Constructor Details

    • HookRunner

      public HookRunner(LDLogger logger, List<Hook> initialHooks)
      Builds a runner whose evaluations describe no result, so a hook that asks what one identifies is told nothing and treats every evaluation as its own.
    • HookRunner

      public HookRunner(LDLogger logger, List<Hook> initialHooks, EvaluationExposureKeySupplier exposureKeySupplier)
  • Method Details

    • addHook

      public void addHook(Hook hook)
      Adds a hook, which the next series to begin will run. A series already under way runs the hooks it began with.
      Parameters:
      hook - the hook to add
    • addHooks

      public void addHooks(Collection<Hook> hooksToAdd)
      Adds hooks, which the next series to begin will run. A series already under way runs the hooks it began with.

      The hooks become visible in a single step, so a series beginning on another thread runs either all of them or none of them, never part of the group. Adding the hooks a plugin contributes this way, rather than with repeated addHook(Hook) calls, keeps hooks that are meant to work as a set from running half applied.

      Parameters:
      hooksToAdd - the hooks to add
    • withEvaluation

      public EvaluationDetail<LDValue> withEvaluation(String method, String key, LDContext context, LDValue defaultValue, HookRunner.EvaluationMethod evalMethod)
      Runs the evaluation series around an evaluation of a flag the caller has not read, so a hook that asks what the evaluation's result identifies is told nothing.
    • withEvaluation

      public EvaluationDetail<LDValue> withEvaluation(String method, String key, LDContext context, LDValue defaultValue, DataModel.Flag flag, HookRunner.EvaluationMethod evalMethod)
      Runs the evaluation series around an evaluation, against the caller's own read of the flag.
      Parameters:
      flag - the read the evaluation derives its result from, so that a hook is told about the result the evaluation returns rather than about a later read of the store
    • identify

      public HookRunner.AfterIdentifyMethod identify(LDContext context, Integer timeout)
    • afterTrack

      public void afterTrack(String key, LDContext context, LDValue data, Double metricValue)