Class StickyAttributeValues

java.lang.Object
growthbook.sdk.java.multiusermode.internal.StickyAttributeValues

public final class StickyAttributeValues extends Object
INTERNAL: not part of the supported API. Public only because GrowthBookClient lives in the parent package — treat its signatures as free to change without a major version bump. Formats sticky-bucket identifier attribute values exactly as evaluation formats hash values (GrowthBookUtils.toHashValue), so the documents a client reads are keyed the way evaluation writes them: {"id": 1.0} reads id||1, and values that cannot be hash values (booleans, zero, empty strings, null, arrays, objects) are left out.

Stateless and safe for concurrent use.

  • Method Details

    • of

      public static Map<String,String> of(com.google.gson.JsonObject attributes, Collection<String> names)
      The hash-value form of each named attribute that has one.
      Parameters:
      attributes - the merged (global and per-user) attributes
      names - the sticky identifier attribute names to look up
      Returns:
      attribute name to hash value; names without a usable value are absent
    • hashValue

      public static String hashValue(@Nullable com.google.gson.JsonElement value)
      One attribute value as a hash value, or an empty string when it counts as missing.
      Parameters:
      value - the attribute value, or null when absent
      Returns:
      the hash value, or an empty string