Class ParameterValue
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
BooleanParameterValue,FileParameterValue,PasswordParameterValue,RunParameterValue,StringParameterValue
ParameterDefinition.createValue(StaplerRequest2, JSONObject) for
a particular build (although this 'owner' build object is passed in for every method
call as a parameter so that the parameter won't have to persist it.)
Persistence
Instances of ParameterValues are persisted into build's build.xml
through XStream (via ParametersAction), so instances need to be persistable.
Associated Views
value.jelly
Thevalue.jelly view contributes a UI fragment to display the parameter
values used for a build.
Notes
ParameterValueis used to record values of the past build, butParameterDefinitionused back then might be gone already, or represent a different parameter now. So don't try to use the name to inferParameterDefinitionis.
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedParameterValue(String name) protectedParameterValue(String name, String description) -
Method Summary
Modifier and TypeMethodDescriptionvoidbuildEnvironment(Run<?, ?> build, EnvVars env) Adds environmental variables for the builds to the given map.voidbuildEnvVars(AbstractBuild<?, ?> build, EnvVars env) Deprecated.voidbuildEnvVars(AbstractBuild<?, ?> build, Map<String, String> env) Deprecated.as of 1.344 UsebuildEnvironment(Run, EnvVars)instead.createBuildWrapper(AbstractBuild<?, ?> build) Called at the beginning of a build (but afterSCMoperations have taken place) to let aParameterValuecontributes aBuildWrapperto the build.createVariableResolver(AbstractBuild<?, ?> build) Returns aVariableResolverso that other components likeBuilders can perform variable substitution to reflect parameter values into the build process.booleangetAssignedLabel(SubTask task) Controls where the build (that this parameter is submitted to) will happen.Deprecated.since 2008-09-20.final StringgetName()Name of the parameter.Computes a human-readable possible-localized one-line description of the parameter value.getValue()Returns the most natural Java object that represents the actual value, like boolean, string, etc.inthashCode()booleanReturns whether the information contained in this ParameterValue is sensitive or security related.voidsetDescription(String description)
-
Field Details
-
name
-
-
Constructor Details
-
ParameterValue
-
ParameterValue
-
-
Method Details
-
getDescription
-
setDescription
-
getFormattedDescription
-
getName
Name of the parameter. This uniquely distinguishesParameterValueamong other parameters for the same build. This must be the same asParameterDefinition.getName(). -
buildEnvVars
Deprecated.as of 1.344 UsebuildEnvironment(Run, EnvVars)instead.Adds environmental variables for the builds to the given map.This provides a means for a parameter to pass the parameter values to the build to be performed.
When this method is invoked, the map already contains the current "planned export" list. The implementation is expected to add more values to this map (or do nothing)
Formerly, environment variables would be by convention all upper case. (This is so that a Windows/Unix heterogeneous environment won't get inconsistent result depending on which platform to execute.) But now see
EnvVarswhy upper casing is a bad idea.- Parameters:
build- The build for which this parameter is being used. Never null.env- never null.
-
buildEnvVars
Deprecated.UsebuildEnvironment(Run, EnvVars)instead. -
buildEnvironment
Adds environmental variables for the builds to the given map.This provides a means for a parameter to pass the parameter values to the build to be performed.
When this method is invoked, the map already contains the current "planned export" list. The implementation is expected to add more values to this map (or do nothing)
- Parameters:
build- The build for which this parameter is being used. Never null.env- never null.- Since:
- 1.556
-
createBuildWrapper
Called at the beginning of a build (but afterSCMoperations have taken place) to let aParameterValuecontributes aBuildWrapperto the build.This provides a means for a parameter to perform more extensive set up / tear down during a build.
- Parameters:
build- The build for which this parameter is being used. Never null.- Returns:
- null if the parameter has no
BuildWrapperto contribute to.
-
createVariableResolver
Returns aVariableResolverso that other components likeBuilders can perform variable substitution to reflect parameter values into the build process.This is yet another means in which a
ParameterValuecan influence a build.- Parameters:
build- The build for which this parameter is being used. Never null.- Returns:
- if the parameter value is not interested in participating to the
variable replacement process, return
VariableResolver.NONE.
-
getDefinition
Deprecated.since 2008-09-20. parameter definition may change any time. So if you find yourself in need of accessing the information fromParameterDefinition, instead copy them inParameterDefinition.createValue(StaplerRequest2, JSONObject)intoParameterValue.AccessingParameterDefinitionis not a good idea. -
hashCode
public int hashCode() -
equals
-
getShortDescription
Computes a human-readable possible-localized one-line description of the parameter value.This message is used as a tooltip to describe jobs in the queue. The text should be one line without new line. No HTML allowed (the caller will perform necessary HTML escapes, so any text can be returned.)
- Since:
- 1.323
-
isSensitive
public boolean isSensitive()Returns whether the information contained in this ParameterValue is sensitive or security related. Used to determine whether the value provided by this object should be masked in output.Subclasses can override this to control the return value.
- Since:
- 1.378
-
getValue
Returns the most natural Java object that represents the actual value, like boolean, string, etc.- Returns:
- if there is no natural value for this parameter type,
thismay be used;nullmay be used when the value is normally defined but missing in this case for various reasons - Since:
- 1.568
-
getAssignedLabel
Controls where the build (that this parameter is submitted to) will happen.- Returns:
- null to run the build where it normally runs. If non-null, this will
override
AbstractProject.getAssignedLabel(). If a build is submitted with multiple parameters, the first one that returns non-null from this method will win, and all others won't be consulted. - Since:
- 1.414
-
buildEnvironment(Run, EnvVars)instead.