Class FeatureState

    • Constructor Detail

      • 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.
      • FeatureState

        @Deprecated
        public FeatureState​(Feature feature,
                            boolean enabled,
                            List<String> users)
        Deprecated.
        This constructor will be removed soon. You should use FeatureState(Feature, boolean) and setParameter(String, String) instead.
        This constructor creates a new feature state for the given feature. Please not that using this constructor will automatically set strategyId to match the UsernameActivationStrategy.
        Parameters:
        feature - The feature that is represented by this state.
        enabled - boolean indicating whether this feature should be enabled or not.
        users - A list of users
    • Method Detail

      • 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.
      • disable

        public FeatureState disable()
        Disable the feature
      • getUsers

        @Deprecated
        public List<String> getUsers()
        Deprecated.
        This method will be removed soon. Use getParameter(String) instead to read the corresponding strategy parameter.
        The list of users associated with the feature state.
        Returns:
        The user list, never null
      • 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
      • copyOf

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