Package growthbook.sdk.java
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.
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)
-
Nested Class Summary
-
Constructor Summary
ConstructorDescriptionFeatureRule
(String id, String key, Float coverage, ValueType force, ArrayList<ValueType> variations, ArrayList<Float> weights, Namespace namespace, String hashAttribute, com.google.gson.JsonObject condition, ArrayList<ParentCondition> parentConditions, Integer hashVersion, BucketRange range, ArrayList<BucketRange> ranges, ArrayList<VariationMeta> meta, ArrayList<Filter> filters, String seed, String name, String phase, String fallbackAttribute, Boolean disableStickyBucketing, Integer bucketVersion, Integer minBucketVersion, ArrayList<TrackData<ValueType>> tracks) -
Method Summary
Modifier and TypeMethodDescriptionstatic <ValueType>
FeatureRule.FeatureRuleBuilder<ValueType>builder()
boolean
com.google.gson.JsonObject
Optional targeting conditionWhat percent of users should be included in the experiment (between 0 and 1, inclusive)getForce()
Immediately force a specific value (ignore every other option besides condition and coverage)What user attribute should be used to assign variations (defaults to id)The hash version to use (default to 1)getId()
Unique feature rule idgetKey()
The globally unique tracking key for the experiment (default to the feature key)getMeta()
Meta info about the experiment variationsgetName()
Deprecated.Each item defines a prerequisite where a `condition` must evaluate against a parent feature's value (identified by `id`).getPhase()
getRange()
A more precise version of coverageRanges for experiment variationsgetSeed()
Run an experiment (A/B test) and randomly choose between these variationsHow to weight traffic between variations.int
hashCode()
void
setBucketVersion
(Integer bucketVersion) void
setCondition
(com.google.gson.JsonObject condition) Optional targeting conditionvoid
setCoverage
(Float coverage) What percent of users should be included in the experiment (between 0 and 1, inclusive)void
setDisableStickyBucketing
(Boolean disableStickyBucketing) void
setFallbackAttribute
(String fallbackAttribute) void
setFilters
(ArrayList<Filter> filters) void
Immediately force a specific value (ignore every other option besides condition and coverage)void
setHashAttribute
(String hashAttribute) What user attribute should be used to assign variations (defaults to id)void
setHashVersion
(Integer hashVersion) The hash version to use (default to 1)void
Unique feature rule idvoid
The globally unique tracking key for the experiment (default to the feature key)void
setMeta
(ArrayList<VariationMeta> meta) Meta info about the experiment variationsvoid
setMinBucketVersion
(Integer minBucketVersion) void
void
setNamespace
(Namespace namespace) Deprecated.void
setParentConditions
(ArrayList<ParentCondition> parentConditions) Each item defines a prerequisite where a `condition` must evaluate against a parent feature's value (identified by `id`).void
void
setRange
(BucketRange range) A more precise version of coveragevoid
setRanges
(ArrayList<BucketRange> ranges) Ranges for experiment variationsvoid
void
void
setVariations
(ArrayList<ValueType> variations) Run an experiment (A/B test) and randomly choose between these variationsvoid
setWeights
(ArrayList<Float> weights) How to weight traffic between variations.toString()
-
Constructor Details
-
FeatureRule
public FeatureRule(@Nullable String id, @Nullable String key, @Nullable Float coverage, @Nullable ValueType force, @Nullable ArrayList<ValueType> variations, @Nullable ArrayList<Float> weights, @Nullable Namespace namespace, String hashAttribute, @Nullable com.google.gson.JsonObject condition, @Nullable ArrayList<ParentCondition> parentConditions, @Nullable Integer hashVersion, @Nullable BucketRange range, @Nullable ArrayList<BucketRange> ranges, @Nullable ArrayList<VariationMeta> meta, @Nullable ArrayList<Filter> filters, @Nullable String seed, @Nullable String name, @Nullable String phase, @Nullable String fallbackAttribute, @Nullable Boolean disableStickyBucketing, @Nullable Integer bucketVersion, @Nullable Integer minBucketVersion, @Nullable ArrayList<TrackData<ValueType>> tracks)
-
-
Method Details
-
builder
-
getId
Unique feature rule id -
getKey
The globally unique tracking key for the experiment (default to the feature key) -
getCoverage
What percent of users should be included in the experiment (between 0 and 1, inclusive) -
getForce
Immediately force a specific value (ignore every other option besides condition and coverage) -
getVariations
Run an experiment (A/B test) and randomly choose between these variations -
getWeights
How to weight traffic between variations. Must add to 1. -
getNamespace
Deprecated.A tuple that contains the namespace identifier, plus a range of coverage for the experiment. -
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
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
The hash version to use (default to 1) -
getRange
A more precise version of coverage -
getRanges
Ranges for experiment variations -
getMeta
Meta info about the experiment variations -
getFilters
-
getSeed
-
getName
-
getPhase
-
getFallbackAttribute
-
getDisableStickyBucketing
-
getBucketVersion
-
getMinBucketVersion
-
getTracks
-
setId
Unique feature rule id -
setKey
The globally unique tracking key for the experiment (default to the feature key) -
setCoverage
What percent of users should be included in the experiment (between 0 and 1, inclusive) -
setForce
Immediately force a specific value (ignore every other option besides condition and coverage) -
setVariations
Run an experiment (A/B test) and randomly choose between these variations -
setWeights
How to weight traffic between variations. Must add to 1. -
setNamespace
Deprecated.A tuple that contains the namespace identifier, plus a range of coverage for the experiment. -
setHashAttribute
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
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
The hash version to use (default to 1) -
setRange
A more precise version of coverage -
setRanges
Ranges for experiment variations -
setMeta
Meta info about the experiment variations -
setFilters
-
setSeed
-
setName
-
setPhase
-
setFallbackAttribute
-
setDisableStickyBucketing
-
setBucketVersion
-
setMinBucketVersion
-
setTracks
-
equals
-
hashCode
public int hashCode() -
toString
-