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:
  1. Define a new class derived from ChoiceListProvider
  2. Override getChoiceList(), which returns the choices.
  3. Define the internal public static class named DescriptorImpl, derived from Descriptor<ChoiceListProvider>
  4. annotate the DescriptorImpl with Extension
See Also:
  • Constructor Details

    • ChoiceListProvider

      public ChoiceListProvider()
  • Method Details

    • 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 specified
      value - 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 specified
      value - the value specified.
    • requiresBuildPermission

      public boolean requiresBuildPermission()
      Checks if access getChoiceList() from REST API needs the Item.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

      Returns all the ChoiceListProvider subclass whose DescriptorImpl is annotated with Extension.
      Returns:
      DescriptorExtensionList of ChoiceListProvider subclasses.