Package org.togglz.core.activation
Class SystemPropertyActivationStrategy
- java.lang.Object
-
- org.togglz.core.activation.AbstractPropertyDrivenActivationStrategy
-
- org.togglz.core.activation.SystemPropertyActivationStrategy
-
- All Implemented Interfaces:
ActivationStrategy
public class SystemPropertyActivationStrategy extends AbstractPropertyDrivenActivationStrategy implements ActivationStrategy
ActivationStrategy based on a key value pair system property. To activate, the value of the property must match the string value, not case sensitive.Created by Chris Kelley on 5/26/16.
-
-
Field Summary
Fields Modifier and Type Field Description static StringIDstatic StringPARAM_PROPERTY_NAME-
Fields inherited from class org.togglz.core.activation.AbstractPropertyDrivenActivationStrategy
PARAM_NAME, PARAM_PROPERTY_VALUE
-
-
Constructor Summary
Constructors Constructor Description SystemPropertyActivationStrategy()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetId()A unique id for this strategy.StringgetName()A human readable name of the strategy.Parameter[]getParameters()Returns the list of configuration parameter definitions for the strategy.protected StringgetPropertyNameParam()protected StringgetPropertyValue(FeatureState featureState, FeatureUser user, String name)Returns the value of the property with the specifiednameon which to base the activation of the feature.-
Methods inherited from class org.togglz.core.activation.AbstractPropertyDrivenActivationStrategy
getPropertyName, isActive, isActive
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.togglz.core.spi.ActivationStrategy
isActive
-
-
-
-
Field Detail
-
ID
public static final String ID
- See Also:
- Constant Field Values
-
PARAM_PROPERTY_NAME
public static final String PARAM_PROPERTY_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
getId
public String getId()
Description copied from interface:ActivationStrategyA unique id for this strategy. This id is used to persist the selected strategy in theStateRepository.- Specified by:
getIdin interfaceActivationStrategy
-
getName
public String getName()
Description copied from interface:ActivationStrategyA human readable name of the strategy. This name is used to in the admin console to represent the strategy.- Specified by:
getNamein interfaceActivationStrategy
-
getPropertyValue
protected String getPropertyValue(FeatureState featureState, FeatureUser user, String name)
Description copied from class:AbstractPropertyDrivenActivationStrategyReturns the value of the property with the specified
nameon which to base the activation of the feature.- Specified by:
getPropertyValuein classAbstractPropertyDrivenActivationStrategy- Parameters:
featureState- theFeatureStatewhich represents the current configuration of the featureuser- theuserfor which to decide whether the feature is active (may be null)name- the name of the property whose value is to be returned- Returns:
- The (raw) value of the property with the given
nameor null if none could be found.
-
getPropertyNameParam
protected String getPropertyNameParam()
- Overrides:
getPropertyNameParamin classAbstractPropertyDrivenActivationStrategy
-
getParameters
public Parameter[] getParameters()
Description copied from interface:ActivationStrategyReturns the list of configuration parameter definitions for the strategy. Parameters are typically built using a
ParameterBuilderclass but users can also create custom implementations of theParameterinterface.Example:
public Parameter[] getParameters() { return new Parameter[] { ParameterBuilder.create("country").label("Country Code").matching("[A-Z]+") }; }- Specified by:
getParametersin interfaceActivationStrategy- Overrides:
getParametersin classAbstractPropertyDrivenActivationStrategy- See Also:
ParameterBuilder
-
-