Package com.mixpanel.android.mpmetrics
Class FeatureFlagOptions.Builder
java.lang.Object
com.mixpanel.android.mpmetrics.FeatureFlagOptions.Builder
- Enclosing class:
- FeatureFlagOptions
Builder for creating
FeatureFlagOptions instances.
Default values:
enabled=falsecontext= emptyJSONObjectprefetchFlags=true
-
Constructor Summary
ConstructorsConstructorDescriptionBuilder()Builder(FeatureFlagOptions source) Creates a Builder pre-populated with values from an existingFeatureFlagOptions. -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds and returns aFeatureFlagOptionsinstance with the configured settings.context(org.json.JSONObject context) Sets the context used for evaluating feature flags.enabled(boolean enabled) Enables or disables feature flags.prefetchFlags(boolean prefetchFlags) Controls whether feature flags are automatically fetched on the first app foreground event.
-
Constructor Details
-
Builder
public Builder() -
Builder
Creates a Builder pre-populated with values from an existingFeatureFlagOptions.- Parameters:
source- The FeatureFlagOptions to copy values from.
-
-
Method Details
-
enabled
Enables or disables feature flags.- Parameters:
enabled-trueto enable feature flags,falseto disable.- Returns:
- This Builder instance for chaining.
-
context
Sets the context used for evaluating feature flags.The provided JSONObject is defensively copied to prevent external mutation.
- Parameters:
context- A JSONObject containing key-value pairs for the feature flags context, ornullfor an empty context.- Returns:
- This Builder instance for chaining.
-
prefetchFlags
Controls whether feature flags are automatically fetched on the first app foreground event.Set to
falseif you want to manually control when flags are loaded (e.g., by callinggetFlags().loadFlags()yourself).- Parameters:
prefetchFlags-trueto prefetch on first foreground,falseto disable prefetching.- Returns:
- This Builder instance for chaining.
-
build
Builds and returns aFeatureFlagOptionsinstance with the configured settings.- Returns:
- A new
FeatureFlagOptionsinstance.
-