Class FeatureState

java.lang.Object
org.togglz.core.repository.FeatureState
All Implemented Interfaces:
Serializable

public class FeatureState extends Object implements Serializable
This class represents the state of a feature that is persisted by StateRepository implementations.
Author:
Christian Kaltepoth
See Also:
  • Constructor Details

    • FeatureState

      public FeatureState(Feature feature)
      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

      public FeatureState(Feature feature, boolean enabled)
      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

      public FeatureState copy()
      Creates a copy of this state object
    • getFeature

      public Feature 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

      public FeatureState setEnabled(boolean enabled)
      Enables or disables the feature.
    • enable

      public FeatureState enable()
      Enable the feature
    • disable

      public FeatureState disable()
      Disable the feature
    • getStrategyId

      public String getStrategyId()
      Returns the ID of the selected activation strategy.
    • setStrategyId

      public FeatureState setStrategyId(String strategyId)
      Sets the selected activation strategy ID
    • getParameter

      public String getParameter(String name)
      Returns the value of the given parameter. May return null.
    • setParameter

      public FeatureState setParameter(String name, String value)
      Sets a new value for the given parameter.
    • getParameterNames

      public Set<String> getParameterNames()
      Returns a list of all parameter names stored in the FeatureState instance.
    • getParameterMap

      public Map<String,String> getParameterMap()
      Returns an unmodifiable map of parameters
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • copyOf

      public static FeatureState copyOf(FeatureState featureState)
      Returns a copy of a featureState, or null if the featureState is null.