Package com.mixpanel.android.mpmetrics
Class MixpanelFlagVariant
java.lang.Object
com.mixpanel.android.mpmetrics.MixpanelFlagVariant
Represents the data associated with a feature flag variant from the Mixpanel API.
This class stores the key and value of a specific variant for a feature flag.
It can be instantiated either by parsing an API response or by creating a fallback instance.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionMixpanelFlagVariant
(Object value) Constructs aFeatureFlagData
object for creating fallback instances.MixpanelFlagVariant
(String keyAndValue) Constructs aFeatureFlagData
object for creating fallback instances.MixpanelFlagVariant
(String key, Object value) Constructs aFeatureFlagData
object when parsing an API response. -
Method Summary
-
Field Details
-
key
The key of the feature flag variant. This corresponds to the 'variant_key' field in the Mixpanel API response. It cannot be null. -
value
The value of the feature flag variant. This corresponds to the 'variant_value' field in the Mixpanel API response. The value can be of type Boolean, String, Number (Integer, Double, Float, Long), JSONArray, JSONObject, or it can be null.
-
-
Constructor Details
-
MixpanelFlagVariant
Constructs aFeatureFlagData
object when parsing an API response.- Parameters:
key
- The key of the feature flag variant. Corresponds to 'variant_key' from the API. Cannot be null.value
- The value of the feature flag variant. Corresponds to 'variant_value' from the API. Can be Boolean, String, Number, JSONArray, JSONObject, or null.
-
MixpanelFlagVariant
Constructs aFeatureFlagData
object for creating fallback instances. In this case, the providedkeyAndValue
is used as both the key and the value for the feature flag data. This is typically used when a flag is not found and a default string value needs to be returned.- Parameters:
keyAndValue
- The string value to be used as both the key and the value for this fallback. Cannot be null.
-
MixpanelFlagVariant
Constructs aFeatureFlagData
object for creating fallback instances. In this version, the key is set to an empty string (""), and the providedvalue
is used as the value for the feature flag data. This is typically used when a flag is not found or an error occurs, and a default value needs to be provided.- Parameters:
value
- The object value to be used for this fallback. Cannot be null. This can be of type Boolean, String, Number, JSONArray, or JSONObject.
-