Package org.togglz.core.manager
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 Summary
Modifier and TypeMethodDescriptionvoidvoidProvides access to theActivationStrategylist known by the managerGet the current feature user.Provides access to all features the manager is responsible for.getFeatureState(Feature feature) Returns theFeatureStatefor the specified feature.getMetaData(Feature feature) Returns theFeatureMetaDatadescribing the supplied feature.getName()A unique name for this feature manager.booleanChecks whether the supplied feature is active or not.voidsetFeatureState(FeatureState state) Updates the state of a feature.
-
Method Details
-
getName
String getName()A unique name for this feature manager. -
getFeatures
Provides access to all features the manager is responsible for.- Returns:
- Set of features, never
null
-
getMetaData
Returns theFeatureMetaDatadescribing the supplied feature.- Parameters:
feature- The feature to get the metadata for- Returns:
- the metadata for the feature
-
isActive
Checks whether the supplied feature is active or not. Please note that this method will internally use theUserProviderto 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:
trueif the feature is active,falseotherwise
-
getCurrentFeatureUser
FeatureUser getCurrentFeatureUser()Get the current feature user. This method will internally use the configuredUserProviderto obtain the user.- Returns:
- The current
FeatureUseror null if theUserProviderdidn't return any result.
-
getFeatureState
Returns theFeatureStatefor the specified feature. This state represents the current configuration of the feature and is typically persisted by aStateRepositoryacross 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
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 theActivationStrategylist known by the manager- Returns:
- list of
ActivationStrategy
-
enable
-
disable
-