Class UnleashEngine

java.lang.Object
io.getunleash.engine.UnleashEngine

public class UnleashEngine extends Object
  • Constructor Details

    • UnleashEngine

      public UnleashEngine()
    • UnleashEngine

      public UnleashEngine(List<IStrategy> customStrategies)
    • UnleashEngine

      public UnleashEngine(List<IStrategy> customStrategies, IStrategy fallbackStrategy)
  • Method Details

    • takeState

      public void takeState(String clientFeatures) throws YggdrasilInvalidInputException
      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

      public List<String> getBuiltInStrategies()
      Returns a list of built-in strategies that Yggdrasil supports.
      Returns:
      A list of built-in strategies.
    • getCoreVersion

      public static String getCoreVersion()
      Which version of Yggdrasil is being used.
      Returns:
      The version string.
    • getState

      public String getState()
    • listKnownToggles

      public List<FeatureDef> 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.