Class ChoiceListProvider
- java.lang.Object
-
- hudson.model.AbstractDescribableImpl<ChoiceListProvider>
-
- jp.ikedam.jenkins.plugins.extensible_choice_parameter.ChoiceListProvider
-
- All Implemented Interfaces:
ExtensionPoint
,Describable<ChoiceListProvider>
,Serializable
- Direct Known Subclasses:
AddEditedChoiceListProvider
,FilenameChoiceListProvider
,SystemGroovyChoiceListProvider
public abstract class ChoiceListProvider extends AbstractDescribableImpl<ChoiceListProvider> implements ExtensionPoint, Serializable
The abstract base class of modules provides choices. Create a new choice provider in following steps:- Define a new class derived from ChoiceListProvider
- Override getChoiceList(), which returns the choices.
- Define the internal public static class named DescriptorImpl, derived from Descriptor<ChoiceListProvider>
- annotate the DescriptorImpl with Extension
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
-
Constructor Summary
Constructors Constructor Description ChoiceListProvider()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static DescriptorExtensionList<ChoiceListProvider,Descriptor<ChoiceListProvider>>
all()
Returns all the ChoiceListProvider subclass whose DescriptorImpl is annotated with Extension.abstract List<String>
getChoiceList()
Returns the choices.String
getDefaultChoice()
Returns the default choice value.void
onBuildCompletedWithValue(AbstractBuild<?,?> build, ExtensibleChoiceParameterDefinition def, String value)
Called when a build is completed Implementations can override this method, and do custom behavior.void
onBuildTriggeredWithValue(AbstractProject<?,?> job, ExtensibleChoiceParameterDefinition def, String value)
Called when a build is triggered Implementations can override this method, and do custom behavior.boolean
requiresBuildPermission()
Checks if accessgetChoiceList()
from REST API needs theItem.BUILD
permission.-
Methods inherited from class hudson.model.AbstractDescribableImpl
getDescriptor
-
-
-
-
Method Detail
-
getChoiceList
public abstract List<String> getChoiceList()
Returns the choices.- Returns:
- the choices list.
-
getDefaultChoice
public String getDefaultChoice()
Returns the default choice value. null indicates the first one is the default value.- Returns:
- the default choice value.
-
onBuildTriggeredWithValue
public void onBuildTriggeredWithValue(AbstractProject<?,?> job, ExtensibleChoiceParameterDefinition def, String value)
Called when a build is triggered Implementations can override this method, and do custom behavior. Default implementation do nothing at all.- Parameters:
job
- the job with which this choice provider is used.def
- the parameter definition the value specifiedvalue
- the value specified.
-
onBuildCompletedWithValue
public void onBuildCompletedWithValue(AbstractBuild<?,?> build, ExtensibleChoiceParameterDefinition def, String value)
Called when a build is completed Implementations can override this method, and do custom behavior. Default implementation do nothing at all.- Parameters:
build
- the build with which this choice provider is used.def
- the parameter definition the value specifiedvalue
- the value specified.
-
requiresBuildPermission
public boolean requiresBuildPermission()
Checks if accessgetChoiceList()
from REST API needs theItem.BUILD
permission. If true this will currently return the choices only for Job based API calls.- Returns:
- true if allow access to choices only if BUILD permission was granted. false otherwise.
- Since:
- 1.8.0
-
all
public static DescriptorExtensionList<ChoiceListProvider,Descriptor<ChoiceListProvider>> all()
Returns all the ChoiceListProvider subclass whose DescriptorImpl is annotated with Extension.- Returns:
- DescriptorExtensionList of ChoiceListProvider subclasses.
-
-