Class InheritableStringParameterDefinition
- java.lang.Object
-
- hudson.model.ParameterDefinition
-
- hudson.model.SimpleParameterDefinition
-
- hudson.model.StringParameterDefinition
-
- hudson.plugins.project_inheritance.projects.parameters.InheritableStringParameterDefinition
-
- All Implemented Interfaces:
ExtensionPoint
,Describable<ParameterDefinition>
,Serializable
- Direct Known Subclasses:
InheritableStringParameterReferenceDefinition
public class InheritableStringParameterDefinition extends StringParameterDefinition
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
InheritableStringParameterDefinition.DescriptorImpl
static class
InheritableStringParameterDefinition.IModes
static class
InheritableStringParameterDefinition.WhitespaceMode
-
Nested classes/interfaces inherited from class hudson.model.ParameterDefinition
ParameterDefinition.ParameterDescriptor
-
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
-
Field Summary
Fields Modifier and Type Field Description String
variance
This field stores the project variance name that this parameter comes from.-
Fields inherited from class hudson.model.ParameterDefinition
LIST
-
-
Constructor Summary
Constructors Constructor Description InheritableStringParameterDefinition(InheritableStringParameterDefinition other)
InheritableStringParameterDefinition(String name, String defaultValue)
InheritableStringParameterDefinition(String name, String defaultValue, InheritableStringParameterDefinition.IModes iMode, boolean mustHaveDefaultValue, boolean mustBeAssigned, InheritableStringParameterDefinition.WhitespaceMode whitespaceMode, boolean isHidden)
InheritableStringParameterDefinition(String name, String defaultValue, String description, InheritableStringParameterDefinition.IModes inheritanceMode, boolean mustHaveDefaultValue, boolean mustBeAssigned, InheritableStringParameterDefinition.WhitespaceMode whitespaceMode, boolean isHidden)
InheritableStringParameterDefinition(String name, String defaultValue, String description, String inheritanceMode, boolean mustHaveDefaultValue, boolean mustBeAssigned, String whitespaceMode, boolean isHidden)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ParameterDefinition
copyWithDefaultValue(ParameterValue defaultValue)
This function creates a newParameterDefinition
that carries the given value as the default value.ParameterValue
createValue(String value)
Same ascreateValue(StaplerRequest, JSONObject)
, only with a simple assignment of the value, which happens when the user uses the API directly, instead of going through the WebUI.ParameterValue
createValue(org.kohsuke.stapler.StaplerRequest req, net.sf.json.JSONObject jo)
This function is invoked, when the user creates the value from an HTML form request.StringParameterValue
getDefaultParameterValue()
Returns the default value for this parameter.String
getInheritanceMode()
InheritableStringParameterDefinition.IModes
getInheritanceModeAsVar()
boolean
getIsHidden()
String
getLocationString(InheritanceProject root)
This method returns the chain of project names that contribute to the final value of the current parameter.String
getLocationStringViaStapler()
InheritableStringParameterDefinition
getMergeWithOther(ParameterDefinition past)
boolean
getMustBeAssigned()
boolean
getMustHaveDefaultValue()
String
getWhitespaceMode()
InheritableStringParameterDefinition.WhitespaceMode
getWhitespaceModeAsVar()
String
toString()
-
Methods inherited from class hudson.model.StringParameterDefinition
equals, getDefaultValue, getDefaultValue4Build, hashCode, isTrim, setDefaultValue
-
Methods inherited from class hudson.model.SimpleParameterDefinition
createValue, createValue
-
Methods inherited from class hudson.model.ParameterDefinition
all, getDescription, getDescriptor, getFormattedDescription, getName, getType, isValid
-
-
-
-
Field Detail
-
variance
public transient String variance
This field stores the project variance name that this parameter comes from. If this is null, it does not come from a variance but rather from the project itself. If is set to an actual string (even empty), it comes from the variance with that name.This field is meant to be purely informational, as the actual values for the parameters are fetched using
ParameterSelector.getScopedParameterDefinition(InheritanceProject, String)
.
-
-
Constructor Detail
-
InheritableStringParameterDefinition
public InheritableStringParameterDefinition(String name, String defaultValue)
-
InheritableStringParameterDefinition
public InheritableStringParameterDefinition(String name, String defaultValue, InheritableStringParameterDefinition.IModes iMode, boolean mustHaveDefaultValue, boolean mustBeAssigned, InheritableStringParameterDefinition.WhitespaceMode whitespaceMode, boolean isHidden)
-
InheritableStringParameterDefinition
public InheritableStringParameterDefinition(String name, String defaultValue, String description, InheritableStringParameterDefinition.IModes inheritanceMode, boolean mustHaveDefaultValue, boolean mustBeAssigned, InheritableStringParameterDefinition.WhitespaceMode whitespaceMode, boolean isHidden)
-
InheritableStringParameterDefinition
@DataBoundConstructor public InheritableStringParameterDefinition(String name, String defaultValue, String description, String inheritanceMode, boolean mustHaveDefaultValue, boolean mustBeAssigned, String whitespaceMode, boolean isHidden)
-
InheritableStringParameterDefinition
public InheritableStringParameterDefinition(InheritableStringParameterDefinition other)
-
-
Method Detail
-
copyWithDefaultValue
public ParameterDefinition copyWithDefaultValue(ParameterValue defaultValue)
This function creates a newParameterDefinition
that carries the given value as the default value.Do note that due to inheritance, the final default value may be derived from multiple projects/parents. Such a parameter may be derived either as: Fixed, Overwritable or Extensible.
This function does not care for this at all. If you need a fully materialised version of this parameter, use:
getMergeWithOther(ParameterDefinition)
.- Overrides:
copyWithDefaultValue
in classStringParameterDefinition
- Parameters:
defaultValue
- the value to be assigned to the copy as a default. Must be aStringParameterValue
.
-
getLocationString
public String getLocationString(InheritanceProject root)
This method returns the chain of project names that contribute to the final value of the current parameter.- Parameters:
root
- the project to start looking from.- Returns:
- a string. May be empty, but never null.
-
getLocationStringViaStapler
public String getLocationStringViaStapler()
-
getMustHaveDefaultValue
public boolean getMustHaveDefaultValue()
-
getMustBeAssigned
public boolean getMustBeAssigned()
-
getInheritanceMode
public String getInheritanceMode()
-
getInheritanceModeAsVar
public InheritableStringParameterDefinition.IModes getInheritanceModeAsVar()
-
getIsHidden
public boolean getIsHidden()
-
getWhitespaceMode
public String getWhitespaceMode()
-
getWhitespaceModeAsVar
public InheritableStringParameterDefinition.WhitespaceMode getWhitespaceModeAsVar()
-
getMergeWithOther
public InheritableStringParameterDefinition getMergeWithOther(ParameterDefinition past)
-
createValue
public ParameterValue createValue(org.kohsuke.stapler.StaplerRequest req, net.sf.json.JSONObject jo)
This function is invoked, when the user creates the value from an HTML form request. This happens, for example, when a build is triggered through the GUI instead of through the CLI.Note that this function does not actually ensure the inheritance of the values. It expects, that the
ParameterSelector
class has already handled this viagetMergeWithOther(ParameterDefinition)
during the creation of theParametersDefinitionProperty
instance.Also, the check if the derivation was successful is not done here either. It is assumed that the
InheritanceBuild
checks this when the job starts, by callingInheritanceParametersDefinitionProperty.checkParameterSanity(InheritanceBuild, hudson.model.BuildListener)
.- Overrides:
createValue
in classStringParameterDefinition
-
createValue
public ParameterValue createValue(String value)
Same ascreateValue(StaplerRequest, JSONObject)
, only with a simple assignment of the value, which happens when the user uses the API directly, instead of going through the WebUI.- Overrides:
createValue
in classStringParameterDefinition
-
getDefaultParameterValue
public StringParameterValue getDefaultParameterValue()
Returns the default value for this parameter.The only difference to the super function is that it makes sure the value is properly trimmed.
- Overrides:
getDefaultParameterValue
in classStringParameterDefinition
- Returns:
- the local default value for this parameter definition.
-
-