Package growthbook.sdk.java
Class GrowthBook
java.lang.Object
growthbook.sdk.java.GrowthBook
GrowthBook SDK class.
Build a context with
GBContext.builder()
or the GBContext
constructor
and pass it as an argument to the class constructor.-
Constructor Summary
ConstructorDescriptionNo-args constructor.GrowthBook
(GBContext context) Initialize the GrowthBook SDK with a providedGBContext
-
Method Summary
Modifier and TypeMethodDescriptionvoid
destroy()
<ValueType>
FeatureResult<ValueType>evalFeature
(String key, Class<ValueType> valueTypeClass) evaluateCondition
(String attributesJsonString, String conditionJsonString) void
featuresAPIModelSuccessfully
(String featuresDataModel) getFeatureValue
(String featureKey, Boolean defaultValue) getFeatureValue
(String featureKey, Double defaultValue) getFeatureValue
(String featureKey, Float defaultValue) getFeatureValue
(String featureKey, Integer defaultValue) getFeatureValue
(String featureKey, Object defaultValue) getFeatureValue
(String featureKey, String defaultValue) <ValueType>
ValueTypegetFeatureValue
(String featureKey, ValueType defaultValue, Class<ValueType> gsonDeserializableClass) isFeatureEnabled
(String featureKey) <ValueType>
ExperimentResult<ValueType>run
(Experiment<ValueType> experiment) void
setAttributes
(String attributesJsonString) void
setFeatures
(String featuresJsonString) void
void
setOwnStickyBucketService
(StickyBucketService stickyBucketService) void
setSavedGroups
(com.google.gson.JsonObject savedGroups) void
subscribe
(ExperimentRunCallback callback)
-
Constructor Details
-
GrowthBook
Initialize the GrowthBook SDK with a providedGBContext
- Parameters:
context
-GBContext
-
GrowthBook
public GrowthBook()No-args constructor. AGBContext
with default values is created. It's recommended to create your own context withGBContext.builder()
or theGBContext
constructor
-
-
Method Details
-
evalFeature
@Nullable public <ValueType> FeatureResult<ValueType> evalFeature(String key, Class<ValueType> valueTypeClass) -
setFeatures
-
setSavedGroups
public void setSavedGroups(com.google.gson.JsonObject savedGroups) -
setAttributes
-
run
-
setOwnStickyBucketService
-
setInMemoryStickyBucketService
public void setInMemoryStickyBucketService() -
isOn
-
isOff
-
getFeatureValue
-
getFeatureValue
-
getFeatureValue
-
getFeatureValue
-
getFeatureValue
-
getFeatureValue
-
evaluateCondition
-
getFeatureValue
-
destroy
public void destroy() -
subscribe
-
featuresAPIModelSuccessfully
-
isFeatureEnabled
-