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 aMixpanelFlagVariant
object for creating fallback instances.MixpanelFlagVariant
(String keyAndValue) Constructs aMixpanelFlagVariant
object for creating fallback instances.MixpanelFlagVariant
(String key, Object value) Constructs aMixpanelFlagVariant
object when parsing an API response.MixpanelFlagVariant
(String key, Object value, String experimentID, Boolean isExperimentActive, Boolean isQATester) Constructs aMixpanelFlagVariant
object when parsing an API response with optional experiment fields. -
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. -
experimentID
The value of experimentID. This corresponds to the optional 'experiment_id' field in the Mixpanel API response. -
isExperimentActive
The value of isExperimentActive. This corresponds to the optional 'is_experiment_active' field in the Mixpanel API response. -
isQATester
The value of isQATester. This corresponds to the optional 'is_qa_tester' field in the Mixpanel API response.
-
-
Constructor Details
-
MixpanelFlagVariant
Constructs aMixpanelFlagVariant
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
public MixpanelFlagVariant(@NonNull String key, @Nullable Object value, @Nullable String experimentID, @Nullable Boolean isExperimentActive, @Nullable Boolean isQATester) Constructs aMixpanelFlagVariant
object when parsing an API response with optional experiment fields.- 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.experimentID
- The experiment ID. Corresponds to 'experiment_id' from the API. Can be null.isExperimentActive
- Whether the experiment is active. Corresponds to 'is_experiment_active' from the API. Can be null.isQATester
- Whether the user is a QA tester. Corresponds to 'is_qa_tester' from the API. Can be null.
-
MixpanelFlagVariant
Constructs aMixpanelFlagVariant
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 aMixpanelFlagVariant
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.
-