Class FeatureRule<ValueType>

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

public class FeatureRule<ValueType> extends Object
Overrides the defaultValue of a Feature based on a set of requirements. Has a number of optional properties
  • condition (Condition) - Optional targeting condition
  • coverage (number) - What percent of users should be included in the experiment (between 0 and 1, inclusive)
  • force (any) - Immediately force a specific value (ignore every other option besides condition and coverage)
  • variations (any[]) - Run an experiment (A/B test) and randomly choose between these variations
  • key (string) - The globally unique tracking key for the experiment (default to the feature key)
  • weights (number[]) - How to weight traffic between variations. Must add to 1.
  • namespace (Namespace) - Adds the experiment to a namespace
  • hashAttribute (string) - What user attribute should be used to assign variations (defaults to id)
  • Constructor Details

  • Method Details

    • builder

      public static <ValueType> FeatureRule.FeatureRuleBuilder<ValueType> builder()
    • getId

      @Nullable public String getId()
      Unique feature rule id
    • getKey

      @Nullable public String getKey()
      The globally unique tracking key for the experiment (default to the feature key)
    • getCoverage

      @Nullable public Float getCoverage()
      What percent of users should be included in the experiment (between 0 and 1, inclusive)
    • getForce

      @Nullable public ValueType getForce()
      Immediately force a specific value (ignore every other option besides condition and coverage)
    • getVariations

      @Nullable public ArrayList<ValueType> getVariations()
      Run an experiment (A/B test) and randomly choose between these variations
    • getWeights

      @Nullable public ArrayList<Float> getWeights()
      How to weight traffic between variations. Must add to 1.
    • getNamespace

      @Deprecated @Nullable public Namespace getNamespace()
      Deprecated.
      A tuple that contains the namespace identifier, plus a range of coverage for the experiment.
    • getHashAttribute

      public String getHashAttribute()
      What user attribute should be used to assign variations (defaults to id)
    • getCondition

      @Nullable public com.google.gson.JsonObject getCondition()
      Optional targeting condition
    • getParentConditions

      @Nullable public ArrayList<ParentCondition> getParentConditions()
      Each item defines a prerequisite where a `condition` must evaluate against a parent feature's value (identified by `id`). If `gate` is true, then this is a blocking feature-level prerequisite; otherwise it applies to the current rule only.
    • getHashVersion

      @Nullable public Integer getHashVersion()
      The hash version to use (default to 1)
    • getRange

      @Nullable public BucketRange getRange()
      A more precise version of coverage
    • getRanges

      @Nullable public ArrayList<BucketRange> getRanges()
      Ranges for experiment variations
    • getMeta

      @Nullable public ArrayList<VariationMeta> getMeta()
      Meta info about the experiment variations
    • getFilters

      @Nullable public ArrayList<Filter> getFilters()
    • getSeed

      @Nullable public String getSeed()
    • getName

      @Nullable public String getName()
    • getPhase

      @Nullable public String getPhase()
    • getFallbackAttribute

      @Nullable public String getFallbackAttribute()
    • getDisableStickyBucketing

      @Nullable public Boolean getDisableStickyBucketing()
    • getBucketVersion

      @Nullable public Integer getBucketVersion()
    • getMinBucketVersion

      @Nullable public Integer getMinBucketVersion()
    • getTracks

      @Nullable public ArrayList<TrackData<ValueType>> getTracks()
    • setId

      public void setId(@Nullable String id)
      Unique feature rule id
    • setKey

      public void setKey(@Nullable String key)
      The globally unique tracking key for the experiment (default to the feature key)
    • setCoverage

      public void setCoverage(@Nullable Float coverage)
      What percent of users should be included in the experiment (between 0 and 1, inclusive)
    • setForce

      public void setForce(@Nullable ValueType force)
      Immediately force a specific value (ignore every other option besides condition and coverage)
    • setVariations

      public void setVariations(@Nullable ArrayList<ValueType> variations)
      Run an experiment (A/B test) and randomly choose between these variations
    • setWeights

      public void setWeights(@Nullable ArrayList<Float> weights)
      How to weight traffic between variations. Must add to 1.
    • setNamespace

      @Deprecated public void setNamespace(@Nullable Namespace namespace)
      Deprecated.
      A tuple that contains the namespace identifier, plus a range of coverage for the experiment.
    • setHashAttribute

      public void setHashAttribute(String hashAttribute)
      What user attribute should be used to assign variations (defaults to id)
    • setCondition

      public void setCondition(@Nullable com.google.gson.JsonObject condition)
      Optional targeting condition
    • setParentConditions

      public void setParentConditions(@Nullable ArrayList<ParentCondition> parentConditions)
      Each item defines a prerequisite where a `condition` must evaluate against a parent feature's value (identified by `id`). If `gate` is true, then this is a blocking feature-level prerequisite; otherwise it applies to the current rule only.
    • setHashVersion

      public void setHashVersion(@Nullable Integer hashVersion)
      The hash version to use (default to 1)
    • setRange

      public void setRange(@Nullable BucketRange range)
      A more precise version of coverage
    • setRanges

      public void setRanges(@Nullable ArrayList<BucketRange> ranges)
      Ranges for experiment variations
    • setMeta

      public void setMeta(@Nullable ArrayList<VariationMeta> meta)
      Meta info about the experiment variations
    • setFilters

      public void setFilters(@Nullable ArrayList<Filter> filters)
    • setSeed

      public void setSeed(@Nullable String seed)
    • setName

      public void setName(@Nullable String name)
    • setPhase

      public void setPhase(@Nullable String phase)
    • setFallbackAttribute

      public void setFallbackAttribute(@Nullable String fallbackAttribute)
    • setDisableStickyBucketing

      public void setDisableStickyBucketing(@Nullable Boolean disableStickyBucketing)
    • setBucketVersion

      public void setBucketVersion(@Nullable Integer bucketVersion)
    • setMinBucketVersion

      public void setMinBucketVersion(@Nullable Integer minBucketVersion)
    • setTracks

      public void setTracks(@Nullable ArrayList<TrackData<ValueType>> tracks)
    • 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