Class ExtensibleChoiceParameterDefinition
java.lang.Object
hudson.model.ParameterDefinition
hudson.model.SimpleParameterDefinition
jp.ikedam.jenkins.plugins.extensible_choice_parameter.ExtensibleChoiceParameterDefinition
- All Implemented Interfaces:
ExtensionPoint
,Describable<ParameterDefinition>
,Serializable
Provides a choice parameter whose choices can be extended using Extension Points.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
The internal class to work with views.static class
static enum
How to display choices for input valuesNested 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
ConstructorsConstructorDescriptionExtensibleChoiceParameterDefinition
(String name, ChoiceListProvider choiceListProvider, boolean editable, String description) Constructor instantiating with parameters in the configuration page. -
Method Summary
Modifier and TypeMethodDescriptioncreateValue
(String value) Decide a value of this parameter from the user input.createValue
(org.kohsuke.stapler.StaplerRequest2 request, net.sf.json.JSONObject jo) Decide a value of this parameter from the user input.protected ParameterValue
Test passed ParameterValue and return.Return choices available for this parameter.The choice provider the user specified.Expose choices to REST web API Expose choices to trigger builds from programs, in the same way to built-in choice parameters.Returns the default value of this parameter.static Pattern
Deprecated.boolean
Is this parameter value can be set to a value not in the choices?void
Methods inherited from class hudson.model.SimpleParameterDefinition
createValue, createValue
Methods inherited from class hudson.model.ParameterDefinition
all, copyWithDefaultValue, createValue, createValue, equals, getDescription, getDescriptor, getFormattedDescription, getName, getType, hashCode, isValid, setDescription
-
Constructor Details
-
ExtensibleChoiceParameterDefinition
@DataBoundConstructor public ExtensibleChoiceParameterDefinition(String name, ChoiceListProvider choiceListProvider, boolean editable, String description) Constructor instantiating with parameters in the configuration page. When instantiating from the saved configuration, the object is directly serialized with XStream, and no constructor is used.- Parameters:
name
- the name of this parameter (used as a variable name).choiceListProvider
- the choice providereditable
- whether this parameter can be a value not in choices.description
- the description of this parameter. Used only for the convenience of users.
-
-
Method Details
-
getNamePattern
Deprecated.Deprecated -
isEditable
public boolean isEditable()Is this parameter value can be set to a value not in the choices?- Returns:
- whether this parameter is editable.
-
getEditableType
- Returns:
- How to display choices for input values
-
setEditableType
@DataBoundSetter public void setEditableType(ExtensibleChoiceParameterDefinition.EditableType editableType) - Parameters:
editableType
- How to display choices for input values
-
getChoiceListProvider
The choice provider the user specified.- Returns:
- choice provider.
-
getEnabledChoiceListProvider
- Returns:
- choice provider only when it's enabled
- See Also:
-
getChoiceList
Return choices available for this parameter.- Returns:
- list of choices. never null.
-
getChoicesForRestApi
@Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class) @Exported(name="choices") public List<String> getChoicesForRestApi()Expose choices to REST web API Expose choices to trigger builds from programs, in the same way to built-in choice parameters. Only users with the Item/BUILD permission can access it.- Returns:
- the list of choices.
null
if no Item/Build permission. - Since:
- 1.7.0
-
createValueCommon
Test passed ParameterValue and return. Common processing of createValue- Parameters:
value
- a value to test.- Returns:
- a value tested. same with value.
-
createValue
public ParameterValue createValue(org.kohsuke.stapler.StaplerRequest2 request, net.sf.json.JSONObject jo) Decide a value of this parameter from the user input.- Overrides:
createValue
in classParameterDefinition
- Parameters:
request
-jo
- the user input- Returns:
- the value of this parameter.
- See Also:
-
createValue
Decide a value of this parameter from the user input.- Specified by:
createValue
in classSimpleParameterDefinition
- Parameters:
value
- the user input- Returns:
- the value of this parameter.
- Throws:
IllegalArgumentException
- The value is not in choices even the field is not editable.- See Also:
-
getDefaultParameterValue
Returns the default value of this parameter. If not specified by the provider, the first value in the choice is used. returns null if no choice list is defined.- Overrides:
getDefaultParameterValue
in classParameterDefinition
- Returns:
- the default value of this parameter.
- See Also:
-