"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "core/src/main/java/hudson/model/ParameterDefinition.java" between
jenkins-jenkins-2.280.tar.gz and jenkins-jenkins-2.281.tar.gz

About: Jenkins is a automation server (written in Java) which can be used to automate all sorts of tasks related to building, testing, and delivering or deploying software (for e.g. as Continuous Integration and Continuous Delivery server). Weekly release.

ParameterDefinition.java  (jenkins-jenkins-2.280):ParameterDefinition.java  (jenkins-jenkins-2.281)
skipping to change at line 39 skipping to change at line 39
import hudson.AbortException; import hudson.AbortException;
import hudson.cli.CLICommand; import hudson.cli.CLICommand;
import hudson.util.DescriptorList; import hudson.util.DescriptorList;
import java.io.Serializable; import java.io.Serializable;
import java.io.IOException; import java.io.IOException;
import java.util.Objects; import java.util.Objects;
import java.util.logging.Logger; import java.util.logging.Logger;
import edu.umd.cs.findbugs.annotations.CheckForNull; import edu.umd.cs.findbugs.annotations.CheckForNull;
import edu.umd.cs.findbugs.annotations.NonNull; import edu.umd.cs.findbugs.annotations.NonNull;
import hudson.Util;
import jenkins.model.Jenkins; import jenkins.model.Jenkins;
import net.sf.json.JSONObject; import net.sf.json.JSONObject;
import org.kohsuke.stapler.DataBoundSetter;
import org.kohsuke.stapler.StaplerRequest; import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.export.Exported; import org.kohsuke.stapler.export.Exported;
import org.kohsuke.stapler.export.ExportedBean; import org.kohsuke.stapler.export.ExportedBean;
/** /**
* Defines a parameter for a build. * Defines a parameter for a build.
* *
* <p> * <p>
* In Jenkins, a user can configure a job to require parameters for a build. * In Jenkins, a user can configure a job to require parameters for a build.
skipping to change at line 96 skipping to change at line 98
* {@link ParameterDefinition} class uses {@code config.jelly} to contribute a f orm * {@link ParameterDefinition} class uses {@code config.jelly} to contribute a f orm
* fragment in the job configuration screen. Values entered there are fed back t o * fragment in the job configuration screen. Values entered there are fed back t o
* {@link ParameterDescriptor#newInstance(StaplerRequest, JSONObject)} to create {@link ParameterDefinition}s. * {@link ParameterDescriptor#newInstance(StaplerRequest, JSONObject)} to create {@link ParameterDefinition}s.
* *
* <h3>index.jelly</h3> * <h3>index.jelly</h3>
* The {@code index.jelly} view contributes a form fragment in the page where th e user * The {@code index.jelly} view contributes a form fragment in the page where th e user
* enters actual values of parameters for a build. The result of this form submi ssion * enters actual values of parameters for a build. The result of this form submi ssion
* is then fed to {@link ParameterDefinition#createValue(StaplerRequest, JSONObj ect)} to * is then fed to {@link ParameterDefinition#createValue(StaplerRequest, JSONObj ect)} to
* create {@link ParameterValue}s. * create {@link ParameterValue}s.
* *
* TODO: what Jelly pages does this object need for rendering UI?
* TODO: {@link ParameterValue} needs to have some mechanism to expose values to
the build
* @see StringParameterDefinition * @see StringParameterDefinition
*/ */
@ExportedBean(defaultVisibility=3) @ExportedBean(defaultVisibility=3)
public abstract class ParameterDefinition implements public abstract class ParameterDefinition implements
Describable<ParameterDefinition>, ExtensionPoint, Serializable { Describable<ParameterDefinition>, ExtensionPoint, Serializable {
private final String name; private final String name;
private final String description; private String description;
public ParameterDefinition(@NonNull String name) { public ParameterDefinition(@NonNull String name) {
this(name, null);
}
public ParameterDefinition(@NonNull String name, String description) {
//Checking as pipeline does not enforce annotations
if (name == null) { if (name == null) {
throw new IllegalArgumentException("Parameter name must be non-null" ); throw new IllegalArgumentException("Parameter name must be non-null" );
} }
this.name = name; this.name = name;
this.description = description; }
/**
* @deprecated Prefer {@link #ParameterDefinition(String)} with a {@link org
.kohsuke.stapler.DataBoundConstructor} and allow {@link #setDescription} to be u
sed as needed
*/
@Deprecated
public ParameterDefinition(@NonNull String name, String description) {
this(name);
setDescription(description);
} }
/** /**
* Create a new instance of this parameter definition and use the passed * Create a new instance of this parameter definition and use the passed
* parameter value as the default value. * parameter value as the default value.
* *
* @since 1.405 * @since 1.405
*/ */
public ParameterDefinition copyWithDefaultValue(ParameterValue defaultValue) { public ParameterDefinition copyWithDefaultValue(ParameterValue defaultValue) {
// By default, just return this again // By default, just return this again
skipping to change at line 150 skipping to change at line 153
return name; return name;
} }
@Exported @Exported
@CheckForNull @CheckForNull
public String getDescription() { public String getDescription() {
return description; return description;
} }
/** /**
* @since TODO
*/
@DataBoundSetter
public void setDescription(@CheckForNull String description) {
this.description = Util.fixEmpty(description);
}
/**
* return parameter description, applying the configured MarkupFormatter for jenkins instance. * return parameter description, applying the configured MarkupFormatter for jenkins instance.
* @since 1.521 * @since 1.521
*/ */
@CheckForNull @CheckForNull
public String getFormattedDescription() { public String getFormattedDescription() {
try { try {
return Jenkins.get().getMarkupFormatter().translate(description); return Jenkins.get().getMarkupFormatter().translate(getDescription() );
} catch (IOException e) { } catch (IOException e) {
LOGGER.warning("failed to translate description using configured mar kup formatter"); LOGGER.warning("failed to translate description using configured mar kup formatter");
return ""; return "";
} }
} }
@Override @Override
@NonNull @NonNull
public ParameterDescriptor getDescriptor() { public ParameterDescriptor getDescriptor() {
return (ParameterDescriptor) Jenkins.get().getDescriptorOrDie(getClass() ); return (ParameterDescriptor) Jenkins.get().getDescriptorOrDie(getClass() );
 End of changes. 8 change blocks. 
11 lines changed or deleted 23 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)