Interface FeatureManager

All Known Implementing Classes:
DefaultFeatureManager, LazyResolvingFeatureManager

public interface FeatureManager
The FeatureManager is the central class in Togglz. It's typically obtained using FeatureContext.getFeatureManager().
Author:
Christian Kaltepoth
  • Method Details

    • getName

      String getName()
      A unique name for this feature manager.
    • getFeatures

      Set<Feature> getFeatures()
      Provides access to all features the manager is responsible for.
      Returns:
      Set of features, never null
    • getMetaData

      FeatureMetaData getMetaData(Feature feature)
      Returns the FeatureMetaData describing the supplied feature.
      Parameters:
      feature - The feature to get the metadata for
      Returns:
      the metadata for the feature
    • isActive

      boolean isActive(Feature feature)
      Checks whether the supplied feature is active or not. Please note that this method will internally use the UserProvider to obtain the currently acting user as it may be relevant if the feature is enabled only for specific set of users.
      Parameters:
      feature - The feature to check
      Returns:
      true if the feature is active, false otherwise
    • getCurrentFeatureUser

      FeatureUser getCurrentFeatureUser()
      Get the current feature user. This method will internally use the configured UserProvider to obtain the user.
      Returns:
      The current FeatureUser or null if the UserProvider didn't return any result.
    • getFeatureState

      FeatureState getFeatureState(Feature feature)
      Returns the FeatureState for the specified feature. This state represents the current configuration of the feature and is typically persisted by a StateRepository across JVM restarts. The state includes whether the feature is enabled or disabled and the use list.
      Parameters:
      feature - The feature to get the state for
      Returns:
      The current state of the feature, never null.
    • setFeatureState

      void setFeatureState(FeatureState state)
      Updates the state of a feature. THis allows to enable or disable a feature and to modify the user list associated with the feature.
      Parameters:
      state - The new feature state.
    • getActivationStrategies

      List<ActivationStrategy> getActivationStrategies()
      Provides access to the ActivationStrategy list known by the manager
      Returns:
      list of ActivationStrategy
    • enable

      void enable(Feature feature)
    • disable

      void disable(Feature feature)