Package org.togglz.core.manager
Interface FeatureManager
-
- All Known Implementing Classes:
DefaultFeatureManager,LazyResolvingFeatureManager
public interface FeatureManagerTheFeatureManageris the central class in Togglz. It's typically obtained usingFeatureContext.getFeatureManager().- Author:
- Christian Kaltepoth
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description List<ActivationStrategy>getActivationStrategies()Provides access to theActivationStrategylist known by the managerFeatureUsergetCurrentFeatureUser()Get the current feature user.Set<Feature>getFeatures()Provides access to all features the manager is responsible for.FeatureStategetFeatureState(Feature feature)Returns theFeatureStatefor the specified feature.FeatureMetaDatagetMetaData(Feature feature)Returns theFeatureMetaDatadescribing the supplied feature.StringgetName()A unique name for this feature manager.booleanisActive(Feature feature)Checks whether the supplied feature is active or not.voidsetFeatureState(FeatureState state)Updates the state of a feature.
-
-
-
Method Detail
-
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 theFeatureMetaDatadescribing 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 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
FeatureState getFeatureState(Feature feature)
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
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 theActivationStrategylist known by the manager- Returns:
- list of
ActivationStrategy
-
-