Class ExperimentResult<ValueType>

java.lang.Object
growthbook.sdk.java.ExperimentResult<ValueType>
Type Parameters:
ValueType - generic type for the value type for this experiment's variations.

public class ExperimentResult<ValueType> extends Object
The result of running an Experiment given a specific GBContext
  • inExperiment (boolean) - Whether or not the user is part of the experiment
  • variationId (int) - The array index of the assigned variation
  • value (any) - The array value of the assigned variation
  • hashUsed (boolean) - If a hash was used to assign a variation
  • hashAttribute (string) - The user attribute used to assign a variation
  • hashValue (string) - The value of that attribute
  • featureId (string or null) - The id of the feature (if any) that the experiment came from
  • Constructor Details

    • ExperimentResult

      public ExperimentResult()
  • Method Details

    • toJson

      public String toJson()
      Serialized JSON string of the ExperimentResult
      Returns:
      JSON string
    • getSerializer

      public static <ValueType> com.google.gson.JsonSerializer<ExperimentResult<ValueType>> getSerializer()
      A Gson serializer for ExperimentResult
      Type Parameters:
      ValueType - type of the experiment
      Returns:
      a Gson serializer