Class EvaluationSeriesContext

java.lang.Object
com.launchdarkly.sdk.android.integrations.EvaluationSeriesContext

public class EvaluationSeriesContext extends Object
Represents parameters associated with a feature flag evaluation. An instance of this class is provided to some stages of series of a Hook implementation. For example, see Hook.beforeEvaluation(EvaluationSeriesContext, Map)
  • Field Details

    • method

      public final String method
      The variation method that was used to invoke the evaluation. The stability of this string is not guaranteed and should not be used in conditional logic.
    • flagKey

      public final String flagKey
      The key of the feature flag being evaluated.
    • context

      public final LDContext context
      The context the evaluation was for.
    • defaultValue

      public final LDValue defaultValue
      The user-provided default value for the evaluation.
  • Constructor Details

    • EvaluationSeriesContext

      public EvaluationSeriesContext(String method, String key, LDContext context, LDValue defaultValue)
      Parameters:
      method - the variation method that was used to invoke the evaluation.
      key - the key of the feature flag being evaluated.
      context - the context the evaluation was for.
      defaultValue - the user-provided default value for the evaluation.
    • EvaluationSeriesContext

      public EvaluationSeriesContext(String method, String key, LDContext context, LDValue defaultValue, @Nullable EvaluationExposureKeySupplier exposureKeySupplier, @Nullable DataModel.Flag flag)
      Used by the SDK, which has read the flag the evaluation will return a result from. Application code has no use for this constructor: a context built with the four-argument one has no exposure key, and getEvaluationExposureKey() explains what that means for a hook that wanted one.

      This constructor is not stable, and not subject to any backwards compatibility guarantees or semantic versioning. It is experimental.

      Parameters:
      method - the variation method that was used to invoke the evaluation.
      key - the key of the feature flag being evaluated.
      context - the context the evaluation was for.
      defaultValue - the user-provided default value for the evaluation.
      exposureKeySupplier - builds the key identifying the result of this evaluation, or null if the result is not known
      flag - the evaluation's own read of the flag, or null if it was not found
  • Method Details

    • getEvaluationExposureKey

      @Nullable public EvaluationExposureKey getEvaluationExposureKey()
      Returns the key identifying the result this evaluation will return, for a hook that decides what to do with an evaluation by whether it has seen the same result before. DedupingHook is such a hook.

      This method is not stable, and not subject to any backwards compatibility guarantees or semantic versioning. It is experimental.

      The key describes the evaluation's own read of the flag, the one its result is derived from, so it is available to Hook.beforeEvaluation(EvaluationSeriesContext, Map) as well as to the after stage, and every hook that asks is told about the same result. It is built on the ask, so an evaluation whose hooks never ask does not pay for one.

      Returns:
      the key identifying this evaluation's result, or null if this context was not built by the SDK and so has no result to describe
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object