Package org.togglz.core.repository
Class FeatureState
java.lang.Object
org.togglz.core.repository.FeatureState
- All Implemented Interfaces:
Serializable
This class represents the state of a feature that is persisted by
StateRepository
implementations.- Author:
- Christian Kaltepoth
- See Also:
-
Constructor Summary
ConstructorDescriptionFeatureState
(Feature feature) This constructor creates a new feature state for the given feature.FeatureState
(Feature feature, boolean enabled) This constructor creates a new feature state for the given feature. -
Method Summary
Modifier and TypeMethodDescriptioncopy()
Creates a copy of this state objectstatic FeatureState
copyOf
(FeatureState featureState) Returns a copy of a featureState, ornull
if the featureState isnull
.disable()
Disable the featureenable()
Enable the featureboolean
Returns the feature represented by this feature state.getParameter
(String name) Returns the value of the given parameter.Returns an unmodifiable map of parametersReturns a list of all parameter names stored in theFeatureState
instance.Returns the ID of the selected activation strategy.int
hashCode()
boolean
Whether this feature is enabled or not.setEnabled
(boolean enabled) Enables or disables the feature.setParameter
(String name, String value) Sets a new value for the given parameter.setStrategyId
(String strategyId) Sets the selected activation strategy ID
-
Constructor Details
-
FeatureState
This constructor creates a new feature state for the given feature. The feature is initially disabled if this constructor is used.- Parameters:
feature
- The feature that is represented by this state.
-
FeatureState
This constructor creates a new feature state for the given feature.- Parameters:
feature
- The feature that is represented by this state.enabled
- boolean indicating whether this feature should be enabled or not.
-
-
Method Details
-
copy
Creates a copy of this state object -
getFeature
Returns the feature represented by this feature state.- Returns:
- The feature, never
null
-
isEnabled
public boolean isEnabled()Whether this feature is enabled or not. -
setEnabled
Enables or disables the feature. -
enable
Enable the feature -
disable
Disable the feature -
getStrategyId
Returns the ID of the selected activation strategy. -
setStrategyId
Sets the selected activation strategy ID -
getParameter
Returns the value of the given parameter. May returnnull
. -
setParameter
Sets a new value for the given parameter. -
getParameterNames
Returns a list of all parameter names stored in theFeatureState
instance. -
getParameterMap
Returns an unmodifiable map of parameters -
equals
-
hashCode
public int hashCode() -
copyOf
Returns a copy of a featureState, ornull
if the featureState isnull
.
-