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 an GrowthBook.run(Experiment) call
  • Constructor Details

    • ExperimentResult

      public ExperimentResult(@Nullable ValueType value, @Nullable Integer variationId, Boolean inExperiment, @Nullable String hashAttribute, @Nullable String hashValue, @Nullable String featureId, Boolean hashUsed, @Nullable String key, @Nullable String name, @Nullable Float bucket, @Nullable Boolean passThrough, @Nullable Boolean stickyBucketUsed)
      The result of running an Experiment given a specific GBContext
      Parameters:
      value - The array value of the assigned variation
      variationId - The array index of the assigned variation
      inExperiment - Whether the user is part of the experiment or not
      hashAttribute - The user attribute used to assign a variation (default: "id")
      hashValue - The value of that attribute
      featureId - The id of the feature (if any) that the experiment came from
      hashUsed - If a hash was used to assign a variation
      key - The experiment key, if any
      name - The human-readable name of the assigned variation
      bucket - The hash value used to assign a variation (float from 0 to 1)
      passThrough - Used for holdout groups
  • Method Details

    • toJson

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

      public static <ValueType> ExperimentResult.ExperimentResultBuilder<ValueType> builder()
    • getValue

      @Nullable public ValueType getValue()
      The array value of the assigned variation
    • getVariationId

      @Nullable public Integer getVariationId()
      The array index of the assigned variation
    • getInExperiment

      public Boolean getInExperiment()
      Whether the user is part of the experiment
    • getHashAttribute

      @Nullable public String getHashAttribute()
      The user attribute used to assign a variation
    • getHashValue

      @Nullable public String getHashValue()
      The value of that attribute
    • getFeatureId

      @Nullable public String getFeatureId()
      The id of the feature (if any) that the experiment came from
    • getHashUsed

      public Boolean getHashUsed()
      If a hash was used to assign a variation
    • getKey

      @Nullable public String getKey()
      The unique key for the assigned variation
    • getName

      @Nullable public String getName()
      The human-readable name of the assigned variation
    • getBucket

      @Nullable public Float getBucket()
      The hash value used to assign a variation (float from 0 to 1)
    • getPassThrough

      @Nullable public Boolean getPassThrough()
      Used for holdout groups
    • getStickyBucketUsed

      @Nullable public Boolean getStickyBucketUsed()
      If sticky bucketing was used to assign a variation
    • setValue

      public void setValue(@Nullable ValueType value)
      The array value of the assigned variation
    • setVariationId

      public void setVariationId(@Nullable Integer variationId)
      The array index of the assigned variation
    • setInExperiment

      public void setInExperiment(Boolean inExperiment)
      Whether the user is part of the experiment
    • setHashAttribute

      public void setHashAttribute(@Nullable String hashAttribute)
      The user attribute used to assign a variation
    • setHashValue

      public void setHashValue(@Nullable String hashValue)
      The value of that attribute
    • setFeatureId

      public void setFeatureId(@Nullable String featureId)
      The id of the feature (if any) that the experiment came from
    • setHashUsed

      public void setHashUsed(Boolean hashUsed)
      If a hash was used to assign a variation
    • setKey

      public void setKey(@Nullable String key)
      The unique key for the assigned variation
    • setName

      public void setName(@Nullable String name)
      The human-readable name of the assigned variation
    • setBucket

      public void setBucket(@Nullable Float bucket)
      The hash value used to assign a variation (float from 0 to 1)
    • setPassThrough

      public void setPassThrough(@Nullable Boolean passThrough)
      Used for holdout groups
    • setStickyBucketUsed

      public void setStickyBucketUsed(@Nullable Boolean stickyBucketUsed)
      If sticky bucketing was used to assign a variation
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object