Package hudson.model
Class ChoiceParameterDefinition
java.lang.Object
hudson.model.ParameterDefinition
hudson.model.SimpleParameterDefinition
hudson.model.ChoiceParameterDefinition
- All Implemented Interfaces:
ExtensionPoint
,Describable<ParameterDefinition>
,Serializable
- Author:
- huybrechts
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class hudson.model.ParameterDefinition
ParameterDefinition.ParameterDescriptor
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
Field Summary
Fields inherited from class hudson.model.ParameterDefinition
LIST
-
Constructor Summary
ConstructorDescriptionChoiceParameterDefinition
(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
Modifier and TypeMethodDescriptionstatic boolean
areValidChoices
(String choices) copyWithDefaultValue
(ParameterValue defaultValue) Create a new instance of this parameter definition and use the passed parameter value as the default value.createValue
(String value) Creates aParameterValue
from the string representation.createValue
(org.kohsuke.stapler.StaplerRequest2 req, net.sf.json.JSONObject jo) Create a parameter value from a form submission.boolean
Returns default parameter value for this definition.int
hashCode()
boolean
isValid
(ParameterValue value) Checks whether a given value is valid for this definition.void
setChoices
(Object choices) Set the list of choices.Methods inherited from class hudson.model.SimpleParameterDefinition
createValue, createValue
Methods inherited from class hudson.model.ParameterDefinition
all, createValue, createValue, getDescription, getDescriptor, getFormattedDescription, getName, getType, setDescription
-
Field Details
-
CHOICES_DELIMITER
- See Also:
-
CHOICES_DELIMETER
Deprecated.- See Also:
-
-
Constructor Details
-
ChoiceParameterDefinition
-
ChoiceParameterDefinition
-
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 Details
-
areValidChoices
-
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
Description copied from class:ParameterDefinition
Create a new instance of this parameter definition and use the passed parameter value as the default value.- Overrides:
copyWithDefaultValue
in classParameterDefinition
-
getChoices
-
getChoicesText
-
getDefaultParameterValue
Description copied from class:ParameterDefinition
Returns default parameter value for this definition.- Overrides:
getDefaultParameterValue
in classParameterDefinition
- Returns:
- default parameter value or null if no defaults are available
-
isValid
Description copied from class:ParameterDefinition
Checks whether a given value is valid for this definition.- Overrides:
isValid
in 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.StaplerRequest2 req, net.sf.json.JSONObject jo) Description copied from class:ParameterDefinition
Create 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.
- Overrides:
createValue
in classParameterDefinition
-
createValue
Description copied from class:SimpleParameterDefinition
Creates aParameterValue
from the string representation.- Specified by:
createValue
in classSimpleParameterDefinition
-
hashCode
public int hashCode()- Overrides:
hashCode
in classParameterDefinition
-
equals
- Overrides:
equals
in classParameterDefinition
-