Package hudson.model
Class ChoiceParameterDefinition
- java.lang.Object
-
- hudson.model.ParameterDefinition
-
- hudson.model.SimpleParameterDefinition
-
- hudson.model.ChoiceParameterDefinition
-
- All Implemented Interfaces:
ExtensionPoint,Describable<ParameterDefinition>,Serializable
public class ChoiceParameterDefinition extends SimpleParameterDefinition
- Author:
- huybrechts
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classChoiceParameterDefinition.DescriptorImpl-
Nested classes/interfaces inherited from class hudson.model.ParameterDefinition
ParameterDefinition.ParameterDescriptor
-
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
-
Field Summary
Fields Modifier and Type Field Description static StringCHOICES_DELIMETERDeprecated.static StringCHOICES_DELIMITER-
Fields inherited from class hudson.model.ParameterDefinition
LIST
-
-
Constructor Summary
Constructors Constructor Description ChoiceParameterDefinition(String name, String description)Databound constructor for reflective instantiation.ChoiceParameterDefinition(String name, String[] choices, String description)ChoiceParameterDefinition(String name, String choices, String description)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static booleanareValidChoices(String choices)ParameterDefinitioncopyWithDefaultValue(ParameterValue defaultValue)Create a new instance of this parameter definition and use the passed parameter value as the default value.StringParameterValuecreateValue(String value)Creates aParameterValuefrom the string representation.ParameterValuecreateValue(org.kohsuke.stapler.StaplerRequest req, net.sf.json.JSONObject jo)Create a parameter value from a form submission.booleanequals(Object obj)List<String>getChoices()StringgetChoicesText()StringParameterValuegetDefaultParameterValue()Returns default parameter value for this definition.inthashCode()booleanisValid(ParameterValue value)Checks whether a given value is valid for this definition.voidsetChoices(Object choices)Set the list of choices.-
Methods inherited from class hudson.model.SimpleParameterDefinition
createValue, createValue
-
Methods inherited from class hudson.model.ParameterDefinition
all, getDescription, getDescriptor, getFormattedDescription, getName, getType, setDescription
-
-
-
-
Field Detail
-
CHOICES_DELIMITER
public static final String CHOICES_DELIMITER
- See Also:
- Constant Field Values
-
CHOICES_DELIMETER
@Deprecated public static final String CHOICES_DELIMETER
Deprecated.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ChoiceParameterDefinition
public ChoiceParameterDefinition(@NonNull String name, @NonNull String choices, @CheckForNull String description)
-
ChoiceParameterDefinition
public ChoiceParameterDefinition(@NonNull String name, @NonNull String[] choices, @CheckForNull String description)
-
ChoiceParameterDefinition
@DataBoundConstructor @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public ChoiceParameterDefinition(String name, String description)
Databound constructor for reflective instantiation.- Parameters:
name- parameter namedescription- parameter description- Since:
- 2.112
-
-
Method Detail
-
areValidChoices
public static boolean areValidChoices(@NonNull String choices)
-
setChoices
@DataBoundSetter @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public void setChoices(Object choices)
Set the list of choices. Legal arguments are String (in which case the arguments gets split into lines) and Collection which sets the list of legal parameters to the String representations of the argument's non-null entries. See JENKINS-26143 for background. This retains the compatibility with the legacy String 'choices' parameter, while supporting the list type as generated by the snippet generator.- Parameters:
choices- String or Collection representing this parameter definition's possible values.- Since:
- 2.112
-
copyWithDefaultValue
public ParameterDefinition copyWithDefaultValue(ParameterValue defaultValue)
Description copied from class:ParameterDefinitionCreate a new instance of this parameter definition and use the passed parameter value as the default value.- Overrides:
copyWithDefaultValuein classParameterDefinition
-
getChoicesText
public String getChoicesText()
-
getDefaultParameterValue
@CheckForNull public StringParameterValue getDefaultParameterValue()
Description copied from class:ParameterDefinitionReturns default parameter value for this definition.- Overrides:
getDefaultParameterValuein classParameterDefinition- Returns:
- default parameter value or null if no defaults are available
-
isValid
public boolean isValid(ParameterValue value)
Description copied from class:ParameterDefinitionChecks whether a given value is valid for this definition.- Overrides:
isValidin classParameterDefinition- Parameters:
value- The value to validate.- Returns:
- True if the value is valid for this definition. False if it is invalid.
-
createValue
public ParameterValue createValue(org.kohsuke.stapler.StaplerRequest req, net.sf.json.JSONObject jo)
Description copied from class:ParameterDefinitionCreate a parameter value from a form submission.This method is invoked when the user fills in the parameter values in the HTML form and submits it to the server.
- Specified by:
createValuein classParameterDefinition
-
createValue
public StringParameterValue createValue(String value)
Description copied from class:SimpleParameterDefinitionCreates aParameterValuefrom the string representation.- Specified by:
createValuein classSimpleParameterDefinition
-
hashCode
public int hashCode()
- Overrides:
hashCodein classParameterDefinition
-
equals
public boolean equals(Object obj)
- Overrides:
equalsin classParameterDefinition
-
-