Class GrowthBook

java.lang.Object
growthbook.sdk.java.GrowthBook

public class GrowthBook extends Object
GrowthBook SDK class. Build a context with GBContext.builder() or the GBContext constructor and pass it as an argument to the class constructor.
  • Constructor Details

    • GrowthBook

      public GrowthBook(GBContext context)
      Initialize the GrowthBook SDK with a provided GBContext
      Parameters:
      context - GBContext
    • GrowthBook

      public GrowthBook()
      No-args constructor. A GBContext with default values is created. It's recommended to create your own context with GBContext.builder() or the GBContext constructor
  • Method Details

    • evalFeature

      @Nullable public <ValueType> FeatureResult<ValueType> evalFeature(String key, Class<ValueType> valueTypeClass)
    • setFeatures

      public void setFeatures(String featuresJsonString)
    • setAttributes

      public void setAttributes(String attributesJsonString)
    • run

      public <ValueType> ExperimentResult<ValueType> run(Experiment<ValueType> experiment)
    • isOn

      public Boolean isOn(String featureKey)
    • isOff

      public Boolean isOff(String featureKey)
    • getFeatureValue

      public Boolean getFeatureValue(String featureKey, Boolean defaultValue)
    • getFeatureValue

      public String getFeatureValue(String featureKey, String defaultValue)
    • getFeatureValue

      public Float getFeatureValue(String featureKey, Float defaultValue)
    • getFeatureValue

      public Integer getFeatureValue(String featureKey, Integer defaultValue)
    • getFeatureValue

      public Object getFeatureValue(String featureKey, Object defaultValue)
    • getFeatureValue

      public <ValueType> ValueType getFeatureValue(String featureKey, ValueType defaultValue, Class<ValueType> gsonDeserializableClass)
    • evaluateCondition

      public Boolean evaluateCondition(String attributesJsonString, String conditionJsonString)
    • getFeatureValue

      public Double getFeatureValue(String featureKey, Double defaultValue)
    • destroy

      public void destroy()
    • subscribe

      public void subscribe(ExperimentRunCallback callback)