Package org.togglz.core.activation
Class ParameterBuilder
- java.lang.Object
-
- org.togglz.core.activation.ParameterBuilder
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ParameterBuildercreate(String name)Creates a new builder for a parameter with the given name.ParameterBuilderdescription(String description)Sets an optional description for the parameter displayed in the admin console.StringgetDescription()An optional description of the parameter.StringgetLabel()A human readable label that describes the parameter.StringgetName()The name of the parameter.booleanisLargeText()Returnstrueif the parameter value is typically large so that it should be displayed with an textarea instead of a simple text input field.booleanisOptional()Returnstrueif the parameter is optional.booleanisValid(String value)This method allows to implement custom validation logic for the parameter.ParameterBuilderlabel(String name)A custom human readable label for the parameter.ParameterBuilderlargeText()Specifies that the parameter typically has large texts as a valueParameterBuildermatching(String regex)Sets a regular expression that must match for parameter values to be considered as valid.ParameterBuilderoptional()Configures the parameter to be optional.
-
-
-
Method Detail
-
create
public static ParameterBuilder create(String name)
Creates a new builder for a parameter with the given name. The name is used to store and retrieve the parameter from theFeatureState.
-
label
public ParameterBuilder label(String name)
A custom human readable label for the parameter. If no custom label is set, the builder will use the name of the parameter as a label.
-
matching
public ParameterBuilder matching(String regex)
Sets a regular expression that must match for parameter values to be considered as valid.
-
optional
public ParameterBuilder optional()
Configures the parameter to be optional.
-
largeText
public ParameterBuilder largeText()
Specifies that the parameter typically has large texts as a value
-
description
public ParameterBuilder description(String description)
Sets an optional description for the parameter displayed in the admin console.
-
getName
public String getName()
Description copied from interface:ParameterThe name of the parameter. This name is used to store and retrieve the parameter from theFeatureState.- Specified by:
getNamein interfaceParameter- See Also:
FeatureState.getParameter(String),FeatureState.setParameter(String, String)
-
getLabel
public String getLabel()
Description copied from interface:ParameterA human readable label that describes the parameter.
-
isValid
public boolean isValid(String value)
Description copied from interface:ParameterThis method allows to implement custom validation logic for the parameter.
-
isOptional
public boolean isOptional()
Description copied from interface:ParameterReturnstrueif the parameter is optional.- Specified by:
isOptionalin interfaceParameter
-
isLargeText
public boolean isLargeText()
Description copied from interface:ParameterReturnstrueif the parameter value is typically large so that it should be displayed with an textarea instead of a simple text input field.- Specified by:
isLargeTextin interfaceParameter
-
getDescription
public String getDescription()
Description copied from interface:ParameterAn optional description of the parameter. Can returnnull, if no description exists.- Specified by:
getDescriptionin interfaceParameter
-
-