Package io.getunleash.engine
Class UnleashEngine
java.lang.Object
io.getunleash.engine.UnleashEngine
-
Constructor Summary
ConstructorsConstructorDescriptionUnleashEngine(List<IStrategy> customStrategies) UnleashEngine(List<IStrategy> customStrategies, IStrategy fallbackStrategy) -
Method Summary
Modifier and TypeMethodDescriptionReturns a list of built-in strategies that Yggdrasil supports.static StringWhich version of Yggdrasil is being used.io.getunleash.engine.MetricsBucketGet the metrics for the engine.getState()getVariant(String toggleName, Context context) Used to get the active variant for a toggle and the current context.Used to evaluate a feature toggle.Get all toggles that is loaded in the engine.void
-
Constructor Details
-
UnleashEngine
public UnleashEngine() -
UnleashEngine
-
UnleashEngine
-
-
Method Details
-
takeState
- Throws:
YggdrasilInvalidInputException
-
isEnabled
public FlatResponse<Boolean> isEnabled(String toggleName, Context context) throws YggdrasilInvalidInputException Used to evaluate a feature toggle.- Parameters:
toggleName- The name of the feature toggle to evaluate.context- The context in which to evaluate the feature toggle.- Returns:
- A response containing the evaluation result and impression data.
- Throws:
YggdrasilInvalidInputException- If there is an error evaluating the feature toggle.
-
getVariant
public FlatResponse<VariantDef> getVariant(String toggleName, Context context) throws YggdrasilInvalidInputException Used to get the active variant for a toggle and the current context.- Parameters:
toggleName- The name of the toggle to check.context- The context to use for the toggle check.- Returns:
- A FlatResponse containing the impression data and the active variant.
- Throws:
YggdrasilInvalidInputException- If the input is invalid.
-
getBuiltInStrategies
Returns a list of built-in strategies that Yggdrasil supports.- Returns:
- A list of built-in strategies.
-
getCoreVersion
Which version of Yggdrasil is being used.- Returns:
- The version string.
-
getState
-
listKnownToggles
Get all toggles that is loaded in the engine.- Returns:
- A list of FeatureDef objects representing the loaded toggles.
-
getMetrics
public io.getunleash.engine.MetricsBucket getMetrics()Get the metrics for the engine. Metrics are collected during evaluation of feature toggles as well as when getVariant is called.- Returns:
- A MetricsBucket object representing the engine's metrics.
-