Package growthbook.sdk.java.util
Class UserContextUtils
java.lang.Object
growthbook.sdk.java.util.UserContextUtils
INTERNAL: not part of the supported API. Public only because the multiusermode internals call it
from another package — treat its signatures as free to change without a major version bump.
Builds the per-request
UserContext shared by the local and remote evaluation paths:
overlays user attributes on the client's global attributes and, when a
StickyBucketService is configured, preloads the user's sticky-bucket assignment
documents.
The sticky preload preserves the assignment behaviour that GrowthBookClient relied on
before evaluation was split across GlobalContextManager and RemoteEvalCoordinator.
Without it, multi-user clients using a StickyBucketService would evaluate experiments
without their persisted assignments, changing assignment behaviour and diverging from the
sticky-bucketing contract shared across GrowthBook SDKs.
-
Method Summary
Modifier and TypeMethodDescriptionstatic UserContextmergeAttributesAndPreloadSticky(Options options, UserContext userContext) Merges global and per-user attributes and preloads sticky-bucket assignments for the merged attributes when aStickyBucketServiceis configured and the caller has not already supplied assignment documents.
-
Method Details
-
mergeAttributesAndPreloadSticky
public static UserContext mergeAttributesAndPreloadSticky(Options options, @Nullable UserContext userContext) Merges global and per-user attributes and preloads sticky-bucket assignments for the merged attributes when aStickyBucketServiceis configured and the caller has not already supplied assignment documents.- Parameters:
options- client options (global attributes and optional sticky bucket service)userContext- the per-request user context;nullis treated as an empty context- Returns:
- a new user context carrying the merged attributes and any preloaded sticky docs
-