Package org.togglz.core.activation
Class ReleaseDateActivationStrategy
- java.lang.Object
-
- org.togglz.core.activation.ReleaseDateActivationStrategy
-
- All Implemented Interfaces:
ActivationStrategy
public class ReleaseDateActivationStrategy extends Object implements ActivationStrategy
-
-
Field Summary
Fields Modifier and Type Field Description static String
ID
static String
PARAM_DATE
static String
PARAM_TIME
-
Constructor Summary
Constructors Constructor Description ReleaseDateActivationStrategy()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getId()
A unique id for this strategy.String
getName()
A human readable name of the strategy.Parameter[]
getParameters()
Returns the list of configuration parameter definitions for the strategy.boolean
isActive(FeatureState featureState, FeatureUser user)
This method is responsible to decide whether a feature is active or not.
-
-
-
Field Detail
-
ID
public static final String ID
- See Also:
- Constant Field Values
-
PARAM_DATE
public static final String PARAM_DATE
- See Also:
- Constant Field Values
-
PARAM_TIME
public static final String PARAM_TIME
- See Also:
- Constant Field Values
-
-
Method Detail
-
getId
public String getId()
Description copied from interface:ActivationStrategy
A unique id for this strategy. This id is used to persist the selected strategy in theStateRepository
.- Specified by:
getId
in interfaceActivationStrategy
-
getName
public String getName()
Description copied from interface:ActivationStrategy
A human readable name of the strategy. This name is used to in the admin console to represent the strategy.- Specified by:
getName
in interfaceActivationStrategy
-
isActive
public boolean isActive(FeatureState featureState, FeatureUser user)
Description copied from interface:ActivationStrategy
This method is responsible to decide whether a feature is active or not. The implementation can use the custom configuration parameters of the strategy stored in the feature state and information from the currently acting user to find a decision.- Specified by:
isActive
in interfaceActivationStrategy
- Parameters:
featureState
- The feature state which represents the current configuration of the feature. The implementation of the method typically usesFeatureState.getParameter(String)
to access custom configuration parameter values.user
- The user for which to decide whether the feature is active. May benull
if the user could not be identified by theUserProvider
.- Returns:
true
if the feature should be active, elsefalse
-
getParameters
public Parameter[] getParameters()
Description copied from interface:ActivationStrategy
Returns the list of configuration parameter definitions for the strategy. Parameters are typically built using a
ParameterBuilder
class but users can also create custom implementations of theParameter
interface.Example:
public Parameter[] getParameters() { return new Parameter[] { ParameterBuilder.create("country").label("Country Code").matching("[A-Z]+") }; }
- Specified by:
getParameters
in interfaceActivationStrategy
- See Also:
ParameterBuilder
-
-