Package growthbook.sdk.java
Class GBFeaturesRepository
java.lang.Object
growthbook.sdk.java.GBFeaturesRepository
This class can be created with its `builder()` or constructor.
It will fetch the features from the endpoint provided.
Initialize with
initialize()
Get the features JSON with getFeaturesJson().
You would provide the features JSON when creating the GBContext-
Constructor Summary
ConstructorsConstructorDescriptionGBFeaturesRepository(String endpoint, String encryptionKey, Integer ttlSeconds) Create a new GBFeaturesRepository -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidvoidonFeaturesRefresh(FeatureRefreshCallback callback) Subscribe to feature refresh events This callback is called when the features are successfully refreshed.
-
Constructor Details
-
GBFeaturesRepository
public GBFeaturesRepository(String endpoint, @Nullable String encryptionKey, @Nullable Integer ttlSeconds) Create a new GBFeaturesRepository- Parameters:
endpoint- SDK Endpoint URLencryptionKey- optional key for decrypting encrypted payloadttlSeconds- How often the cache should be invalidated (default: 60)
-
-
Method Details
-
getFeaturesJson
-
onFeaturesRefresh
Subscribe to feature refresh events This callback is called when the features are successfully refreshed. This is called even if the features have not changed. This will not be called if fetching the features results in a failure.- Parameters:
callback- This callback will be called when features are refreshed
-
clearCallbacks
public void clearCallbacks() -
initialize
- Throws:
FeatureFetchException
-