public class UnlaunchFeature extends Object
This class wraps the result of a feature flag evaluation. It makes all evaluation data available in one class, including:
Use this class if you want to retrieve Configuration attached to variation or get the Evaluation Reason. If
you just want to retrieve variation, you can also use the (shortcut)
UnlaunchClient.getVariation(String, String)
method.
Modifier and Type | Method | Description |
---|---|---|
static UnlaunchFeature |
create(String flagKey,
String variationKey,
Map<String,String> properties) |
|
static UnlaunchFeature |
create(String flagKey,
String variationKey,
Map<String,String> properties,
String evaluationReason) |
|
String |
getEvaluationReason() |
Provides a detailed evaluation reason as to why the variation (result of
getVariation() ) was chosen. |
String |
getFlag() |
Returns the key of the flag this was evaluated for.
|
String |
getVariation() |
Evaluates and returns the variation (variation key) for this feature.
|
UnlaunchDynamicConfig |
getVariationConfig() |
Returns
UnlaunchDynamicConfig object which contains configuration (Key-Value) that you attached to
the variation in the Unlaunch Console. |
Map<String,String> |
getVariationConfigAsMap() |
Returns Key-Value configuration as a
Map that you defined in the Unlaunch Console using the
"Configuration" tab on the feature flag details page. |
public String getFlag()
public String getVariation()
This method returns "control" if:
This method doesn't throw any exceptions nor does it return null
value
public Map<String,String> getVariationConfigAsMap()
Map
that you defined in the Unlaunch Console using the
"Configuration" tab on the feature flag details page.Map
of Key-Value configuration for the evaluated variation.public UnlaunchDynamicConfig getVariationConfig()
UnlaunchDynamicConfig
object which contains configuration (Key-Value) that you attached to
the variation in the Unlaunch Console. You can use either this or the
getVariationConfigAsMap()
method to get Configuration depending on what you prefer.UnlaunchDynamicConfig
for configuration (Key-Value)public String getEvaluationReason()
Provides a detailed evaluation reason as to why the variation (result of
getVariation()
) was chosen. This is useful for debugging and troubleshooting when you
are wondering why you're not getting the variation that you were expecting.
Tip: You can also check evaluation reason and view evaluations in real-time using the "Live Tail" feature of the Unlaunch Console. To access the Unlaunch Console, visit https://app.unlaunch.io.
public static UnlaunchFeature create(String flagKey, String variationKey, Map<String,String> properties, String evaluationReason)
Copyright © 2021 Unlaunch. All rights reserved.