Class MixpanelFlagVariant.Source
- Direct Known Subclasses:
MixpanelFlagVariant.Source.Fallback,MixpanelFlagVariant.Source.Network,MixpanelFlagVariant.Source.Persistence
- Enclosing class:
- MixpanelFlagVariant
MixpanelFlagVariant.Source.Network for a fresh
/flags/ response; MixpanelFlagVariant.Source.Persistence for one loaded from the on-disk
persistence layer; MixpanelFlagVariant.Source.Fallback for the developer-supplied fallback the
SDK returned because no real variant was available.
Variants the SDK returns from MixpanelAPI.Flags.getVariant(java.lang.String, com.mixpanel.android.mpmetrics.MixpanelFlagVariant, com.mixpanel.android.mpmetrics.FlagCompletionCallback<com.mixpanel.android.mpmetrics.MixpanelFlagVariant>) or
MixpanelAPI.Flags.getVariantSync(java.lang.String, com.mixpanel.android.mpmetrics.MixpanelFlagVariant) always carry a non-null source.
Variants the developer constructs themselves (to pass in as a fallback) have a
null source until the SDK stamps them on return.
This is a Java 8-compatible discriminated union (no sealed
keyword) so that variant-specific data — namely the persistedAtMillis
timestamp on MixpanelFlagVariant.Source.Persistence — is bundled with the variant rather than
floating as a separate nullable field on MixpanelFlagVariant.
Construct via network() / persistence(long) / fallback().
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classDeveloper-supplied fallback returned by the SDK because no flag was found, the lookup happened before flags were ready, or a fetch failed without a usable persisted blob to fall back to.static final classVariant assigned by the most recent successful /flags/ network call.static final classVariant loaded from the on-disk persistence layer. -
Method Summary
Modifier and TypeMethodDescriptionfallback()SingletonMixpanelFlagVariant.Source.Fallbackinstance — every call returns the same one.network()SingletonMixpanelFlagVariant.Source.Networkinstance — every call returns the same one.persistence(long persistedAtMillis) Returns aMixpanelFlagVariant.Source.Persistencesource stamped with the given write timestamp.
-
Method Details
-
network
SingletonMixpanelFlagVariant.Source.Networkinstance — every call returns the same one. -
persistence
Returns aMixpanelFlagVariant.Source.Persistencesource stamped with the given write timestamp.- Parameters:
persistedAtMillis- absolute timestamp (millis since epoch) at which this variant set was originally written to disk.
-
fallback
SingletonMixpanelFlagVariant.Source.Fallbackinstance — every call returns the same one.
-