Class JsonParameterReferenceDefinition.DescriptorImpl
java.lang.Object
hudson.model.Descriptor<ParameterDefinition>
hudson.model.ParameterDefinition.ParameterDescriptor
com.github.cyanbaz.jenkins.plugins.jsonparameter.JsonParameterReferenceDefinition.DescriptorImpl
- Enclosing class:
- JsonParameterReferenceDefinition
@Extension
@Symbol("jsonParamRef")
public static class JsonParameterReferenceDefinition.DescriptorImpl
extends ParameterDefinition.ParameterDescriptor
Descriptor for
JsonParameterReferenceDefinition
.
Registers the parameter type under the symbol jsonParamRef
and provides
the Stapler endpoint doLoadOptions
, which Jenkins uses to fetch the filtered
options at runtime when the referenced parameter changes.
-
Nested Class Summary
Nested classes/interfaces inherited from class hudson.model.Descriptor
Descriptor.FormException, Descriptor.PropertyType, Descriptor.Self
-
Field Summary
Fields inherited from class hudson.model.Descriptor
clazz
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.kohsuke.stapler.HttpResponse
doLoadOptions
(Job<?, ?> job, String paramName, String refValue) AJAX endpoint used by the build form to populate the dropdown of aJsonParameterReferenceDefinition
.Returns the display name shown in the Jenkins UI.Methods inherited from class hudson.model.ParameterDefinition.ParameterDescriptor
getValuePage
Methods inherited from class hudson.model.Descriptor
addHelpFileRedirect, bindJSON, bindJSON, calcAutoCompleteSettings, calcFillSettings, configure, configure, configure, doHelp, doHelp, find, find, findByDescribableClassName, findById, getCategory, getCheckMethod, getCheckUrl, getConfigFile, getConfigPage, getCurrentDescriptorByNameUrl, getDescriptorFullUrl, getDescriptorUrl, getGlobalConfigPage, getGlobalPropertyType, getHelpFile, getHelpFile, getHelpFile, getId, getJsonSafeClassName, getKlass, getPlugin, getPossibleViewNames, getPropertyType, getPropertyType, getPropertyTypeOrDie, getRequiredGlobalConfigPagePermission, getStaticHelpUrl, getStaticHelpUrl, getT, getViewPage, isInstance, isSubTypeOf, load, newInstance, newInstance, newInstance, newInstancesFromHeteroList, newInstancesFromHeteroList, newInstancesFromHeteroList, newInstancesFromHeteroList, save, self, toArray, toList, toMap
-
Constructor Details
-
DescriptorImpl
public DescriptorImpl()
-
-
Method Details
-
getDisplayName
Returns the display name shown in the Jenkins UI.- Overrides:
getDisplayName
in classParameterDefinition.ParameterDescriptor
- Returns:
- A string representing the UI name
-
doLoadOptions
@POST public org.kohsuke.stapler.HttpResponse doLoadOptions(@AncestorInPath Job<?, ?> job, @QueryParameter String paramName, @QueryParameter String refValue) AJAX endpoint used by the build form to populate the dropdown of aJsonParameterReferenceDefinition
.This method is invoked via
descriptorByName/.../loadOptions
whenever the referenced parameter changes. It resolves the query by substituting the placeholder (e.g.${USERS}
) with the current reference value, evaluates the JSON source, and returns a JSON array of option objects:[ {"name":"Alice","value":"alice","selected":false}, {"name":"Bob","value":"bob","selected":true} ]
Errors are returned as an array with a single object containing an explanatory
name
and emptyvalue
.- Parameters:
job
- the job context (injected by Stapler)paramName
- the name of the parameter definition to resolverefValue
- the current value of the referenced parameter (may be empty)- Returns:
- JSON array of dropdown options or an error placeholder
-