Package growthbook.sdk.java
Class FeatureResult<ValueType>
java.lang.Object
growthbook.sdk.java.FeatureResult<ValueType>
- Type Parameters:
ValueType
- value type for the feature
Results for a
IFeatureEvaluator.evaluateFeature(String, GBContext, Class, JsonObject)
- value (any) - The assigned value of the feature
- on (boolean) - The assigned value cast to a boolean
- off (boolean) - The assigned value cast to a boolean and then negated
- source (enum) - One of "unknownFeature", "defaultValue", "force", or "experiment"
- experiment (Experiment or null) - When source is "experiment", this will be an Experiment object
- experimentResult (ExperimentResult or null) - When source is "experiment", this will be an ExperimentResult object
-
Nested Class Summary
-
Constructor Summary
ConstructorDescriptionFeatureResult
(Object value, FeatureResultSource source, Experiment<ValueType> experiment, ExperimentResult<ValueType> experimentResult, String ruleId) -
Method Summary
Modifier and TypeMethodDescriptionstatic <ValueType>
FeatureResult.FeatureResultBuilder<ValueType>builder()
boolean
When source is "experiment", this will be the Experiment object usedWhen source is "experiment", this will be an ExperimentResult objectstatic <ValueType>
com.google.gson.JsonElementgetJson
(FeatureResult<ValueType> object) Get a Gson JsonElement of theFeatureResult
Unique identifier of rulestatic <ValueType>
com.google.gson.JsonSerializer<FeatureResult<ValueType>>a Gson serializer forFeatureResult
One of "unknownFeature", "defaultValue", "force", "experiment", "cyclicPrerequisite" or "prerequisite"getValue()
The assigned value of the featureint
hashCode()
isOff()
Evaluates to true when the feature is offisOn()
Evaluates to true when the feature is onvoid
setExperiment
(Experiment<ValueType> experiment) When source is "experiment", this will be the Experiment object usedvoid
setExperimentResult
(ExperimentResult<ValueType> experimentResult) When source is "experiment", this will be an ExperimentResult objectvoid
Unique identifier of rulevoid
setSource
(FeatureResultSource source) One of "unknownFeature", "defaultValue", "force", "experiment", "cyclicPrerequisite" or "prerequisite"void
The assigned value of the featuretoJson()
Get a Gson JsonElement of theFeatureResult
toString()
-
Constructor Details
-
FeatureResult
public FeatureResult(@Nullable Object value, @Nullable FeatureResultSource source, @Nullable Experiment<ValueType> experiment, @Nullable ExperimentResult<ValueType> experimentResult, @Nullable String ruleId)
-
-
Method Details
-
toJson
Get a Gson JsonElement of theFeatureResult
- Returns:
- a Gson JsonElement
-
isOn
Evaluates to true when the feature is on- Returns:
- Boolean
-
isOff
Evaluates to true when the feature is off- Returns:
- Boolean
-
getJson
Get a Gson JsonElement of theFeatureResult
- Type Parameters:
ValueType
- value type for the feature- Parameters:
object
-FeatureResult
- Returns:
- a Gson JsonElement
-
getSerializer
a Gson serializer forFeatureResult
- Type Parameters:
ValueType
-FeatureResult
- Returns:
- Gson serializer
-
builder
-
getValue
The assigned value of the feature -
getSource
One of "unknownFeature", "defaultValue", "force", "experiment", "cyclicPrerequisite" or "prerequisite" -
getExperiment
When source is "experiment", this will be the Experiment object used -
getExperimentResult
When source is "experiment", this will be an ExperimentResult object -
getRuleId
Unique identifier of rule -
setValue
The assigned value of the feature -
setSource
One of "unknownFeature", "defaultValue", "force", "experiment", "cyclicPrerequisite" or "prerequisite" -
setExperiment
When source is "experiment", this will be the Experiment object used -
setExperimentResult
When source is "experiment", this will be an ExperimentResult object -
setRuleId
Unique identifier of rule -
equals
-
hashCode
public int hashCode() -
toString
-