Package growthbook.sdk.java
Class Experiment<ValueType>
java.lang.Object
growthbook.sdk.java.Experiment<ValueType>
Defines a single Experiment
-
Nested Class Summary
-
Constructor Summary
ConstructorDescriptionExperiment
(String key, ArrayList<ValueType> variations, ArrayList<Float> weights, Boolean isActive, Float coverage, com.google.gson.JsonObject conditionJson, ArrayList<ParentCondition> parentConditions, Namespace namespace, Integer force, String hashAttribute, Integer hashVersion, ArrayList<BucketRange> ranges, ArrayList<VariationMeta> meta, ArrayList<Filter> filters, String seed, String name, String phase, String fallbackAttribute, Boolean disableStickyBucketing, Integer bucketVersion, Integer minBucketVersion) -
Method Summary
Modifier and TypeMethodDescriptionstatic <ValueType>
Experiment.ExperimentBuilder<ValueType>builder()
boolean
The sticky bucket version number that can be used to force a re-bucketing of users (default to 0)com.google.gson.JsonObject
Optional targeting conditionWhat percent of users should be included in the experiment (between 0 and 1, inclusive)If true, sticky bucketing will be disabled for this experiment.When using sticky bucketing, can be used as a fallback to assign variationsArray of filters to applygetForce()
All users included in the experiment will be forced into the specific variation indexWhat user attribute should be used to assign variations (defaults to `id`) All users included in the experiment will be forced into the specific variation indexThe hash version to use (default to 1)If set to false, always return the control (first variation)static <ValueType>
com.google.gson.JsonElementgetJson
(Experiment<ValueType> object) Get a Gson JsonElement of the experimentgetKey()
The globally unique identifier for the experimentgetMeta()
Meta info about the variationsAny users with a sticky bucket version less than this will be excluded from the experimentgetName()
Human-readable name for the experimentDeprecated.Each item defines a prerequisite where a `condition` must evaluate against a parent feature's value (identified by `id`).getPhase()
Identifier of the current experiment phaseArray of ranges, one per variationgetSeed()
The hash seed to useThe different variations to choose betweenHow to weight traffic between variations.int
hashCode()
void
setBucketVersion
(Integer bucketVersion) The sticky bucket version number that can be used to force a re-bucketing of users (default to 0)void
setConditionJson
(com.google.gson.JsonObject conditionJson) 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) If true, sticky bucketing will be disabled for this experiment.void
setFallbackAttribute
(String fallbackAttribute) When using sticky bucketing, can be used as a fallback to assign variationsvoid
setFilters
(ArrayList<Filter> filters) Array of filters to applyvoid
All users included in the experiment will be forced into the specific variation indexvoid
setHashAttribute
(String hashAttribute) What user attribute should be used to assign variations (defaults to `id`) All users included in the experiment will be forced into the specific variation indexvoid
setHashVersion
(Integer hashVersion) The hash version to use (default to 1)void
setIsActive
(Boolean isActive) If set to false, always return the control (first variation)void
The globally unique identifier for the experimentvoid
setMeta
(ArrayList<VariationMeta> meta) Meta info about the variationsvoid
setMinBucketVersion
(Integer minBucketVersion) Any users with a sticky bucket version less than this will be excluded from the experimentvoid
Human-readable name for the experimentvoid
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
Identifier of the current experiment phasevoid
setRanges
(ArrayList<BucketRange> ranges) Array of ranges, one per variationvoid
The hash seed to usevoid
setVariations
(ArrayList<ValueType> variations) The different variations to choose betweenvoid
setWeights
(ArrayList<Float> weights) How to weight traffic between variations.toJson()
Get a Gson JsonElement of the experimenttoString()
-
Constructor Details
-
Experiment
public Experiment(String key, ArrayList<ValueType> variations, @Nullable ArrayList<Float> weights, @Nullable Boolean isActive, Float coverage, com.google.gson.JsonObject conditionJson, @Nullable ArrayList<ParentCondition> parentConditions, @Nullable Namespace namespace, Integer force, String hashAttribute, @Nullable Integer hashVersion, @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)
-
-
Method Details
-
toJson
Get a Gson JsonElement of the experiment- Returns:
- JsonElement
-
toString
-
getJson
Get a Gson JsonElement of the experiment- Type Parameters:
ValueType
- value type for the experiment- Parameters:
object
- experiment- Returns:
- JsonElement
-
builder
-
getKey
The globally unique identifier for the experiment -
getVariations
The different variations to choose between -
getWeights
How to weight traffic between variations. Must add to 1. -
getIsActive
If set to false, always return the control (first variation) -
getCoverage
What percent of users should be included in the experiment (between 0 and 1, inclusive) -
getConditionJson
public com.google.gson.JsonObject getConditionJson()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. -
getNamespace
Deprecated.A tuple that contains the namespace identifier, plus a range of coverage for the experiment -
getForce
All users included in the experiment will be forced into the specific variation index -
getHashAttribute
What user attribute should be used to assign variations (defaults to `id`) All users included in the experiment will be forced into the specific variation index -
getHashVersion
The hash version to use (default to 1) -
getRanges
Array of ranges, one per variation -
getMeta
Meta info about the variations -
getFilters
Array of filters to apply -
getSeed
The hash seed to use -
getName
Human-readable name for the experiment -
getPhase
Identifier of the current experiment phase -
getFallbackAttribute
When using sticky bucketing, can be used as a fallback to assign variations -
getDisableStickyBucketing
If true, sticky bucketing will be disabled for this experiment. (Note: sticky bucketing is only available if a StickyBucketingService is provided in the Context) -
getBucketVersion
The sticky bucket version number that can be used to force a re-bucketing of users (default to 0) -
getMinBucketVersion
Any users with a sticky bucket version less than this will be excluded from the experiment -
setKey
The globally unique identifier for the experiment -
setVariations
The different variations to choose between -
setWeights
How to weight traffic between variations. Must add to 1. -
setIsActive
If set to false, always return the control (first variation) -
setCoverage
What percent of users should be included in the experiment (between 0 and 1, inclusive) -
setConditionJson
public void setConditionJson(com.google.gson.JsonObject conditionJson) 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. -
setNamespace
Deprecated.A tuple that contains the namespace identifier, plus a range of coverage for the experiment -
setForce
All users included in the experiment will be forced into the specific variation index -
setHashAttribute
What user attribute should be used to assign variations (defaults to `id`) All users included in the experiment will be forced into the specific variation index -
setHashVersion
The hash version to use (default to 1) -
setRanges
Array of ranges, one per variation -
setMeta
Meta info about the variations -
setFilters
Array of filters to apply -
setSeed
The hash seed to use -
setName
Human-readable name for the experiment -
setPhase
Identifier of the current experiment phase -
setFallbackAttribute
When using sticky bucketing, can be used as a fallback to assign variations -
setDisableStickyBucketing
If true, sticky bucketing will be disabled for this experiment. (Note: sticky bucketing is only available if a StickyBucketingService is provided in the Context) -
setBucketVersion
The sticky bucket version number that can be used to force a re-bucketing of users (default to 0) -
setMinBucketVersion
Any users with a sticky bucket version less than this will be excluded from the experiment -
equals
-
hashCode
public int hashCode()
-