Class FeatureSnapshot

java.lang.Object
growthbook.sdk.java.repository.FeatureSnapshot

public final class FeatureSnapshot extends Object
Immutable view of one successfully processed features payload: the raw JSON strings and their parsed forms, captured together.

The repository swaps a single AtomicReference<FeatureSnapshot> on refresh, so a reader always observes features and saved groups from the SAME payload. Reading the parts through separate getters across a concurrent refresh could otherwise pair new features with old saved groups.

  • Field Details

  • Method Details

    • of

      public static FeatureSnapshot of(String featuresJson, String savedGroupsJson, Map<String,Feature<?>> parsedFeatures, com.google.gson.JsonObject parsedSavedGroups)
      Builds a snapshot from pre-parsed parts. Intended for tests and callers constructing synthetic payloads; the repository builds its own snapshots from fetched responses.
      Parameters:
      featuresJson - raw features JSON
      savedGroupsJson - raw saved groups JSON
      parsedFeatures - parsed feature definitions
      parsedSavedGroups - parsed saved groups
      Returns:
      an immutable snapshot of the supplied parts
    • getFeaturesJson

      public String getFeaturesJson()
    • getSavedGroupsJson

      public String getSavedGroupsJson()
    • getParsedFeatures

      public Map<String,Feature<?>> getParsedFeatures()
    • getParsedSavedGroups

      public com.google.gson.JsonObject getParsedSavedGroups()