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 TypeMethodDescriptionvoid
void
Provides access to theActivationStrategy
list known by the managerGet the current feature user.Provides access to all features the manager is responsible for.getFeatureState
(Feature feature) Returns theFeatureState
for the specified feature.getMetaData
(Feature feature) Returns theFeatureMetaData
describing the supplied feature.getName()
A unique name for this feature manager.boolean
Checks whether the supplied feature is active or not.void
setFeatureState
(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 theFeatureMetaData
describing 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 theUserProvider
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 configuredUserProvider
to obtain the user.- Returns:
- The current
FeatureUser
or null if theUserProvider
didn't return any result.
-
getFeatureState
Returns theFeatureState
for the specified feature. This state represents the current configuration of the feature and is typically persisted by aStateRepository
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
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 theActivationStrategy
list known by the manager- Returns:
- list of
ActivationStrategy
-
enable
-
disable
-