Package hudson.model

Class ChoiceParameterDefinition

    • Constructor Detail

      • ChoiceParameterDefinition

        public ChoiceParameterDefinition​(@NonNull
                                         String name,
                                         @NonNull
                                         String choices,
                                         @CheckForNull
                                         String description)
      • ChoiceParameterDefinition

        public ChoiceParameterDefinition​(@NonNull
                                         String name,
                                         @NonNull
                                         String[] choices,
                                         @CheckForNull
                                         String description)
      • ChoiceParameterDefinition

        @DataBoundConstructor
        @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class)
        public ChoiceParameterDefinition​(String name,
                                         String description)
        Databound constructor for reflective instantiation.
        Parameters:
        name - parameter name
        description - parameter description
        Since:
        2.112
    • Method Detail

      • areValidChoices

        public static boolean areValidChoices​(@NonNull
                                              String choices)
      • 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
      • getChoices

        @NonNull
        @Exported
        public List<String> getChoices()
      • getChoicesText

        public String getChoicesText()
      • isValid

        public boolean isValid​(ParameterValue value)
        Description copied from class: ParameterDefinition
        Checks whether a given value is valid for this definition.
        Overrides:
        isValid in class ParameterDefinition
        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.StaplerRequest 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.

        Specified by:
        createValue in class ParameterDefinition