Class InheritableStringParameterReferenceDefinition
- java.lang.Object
-
- hudson.model.ParameterDefinition
-
- hudson.model.SimpleParameterDefinition
-
- hudson.model.StringParameterDefinition
-
- hudson.plugins.project_inheritance.projects.parameters.InheritableStringParameterDefinition
-
- hudson.plugins.project_inheritance.projects.parameters.InheritableStringParameterReferenceDefinition
-
- All Implemented Interfaces:
ExtensionPoint
,Describable<ParameterDefinition>
,Serializable
public class InheritableStringParameterReferenceDefinition extends InheritableStringParameterDefinition
This class extendsInheritableStringParameterDefinition
by enabling the user to make a reference to an actual, full, parameter definition.This avoids the user having to constantly redefine the additional flags of these parameters, as well as offering a nice drop-down box for parameter names.
Do note that this means, that instances of this class do not make use of the extended fields offered by the definition. As such, these fields are hidden entirely from the serialised XML by making use of an
InheritableParameterReferenceConverter
.- Author:
- Martin Schroeder
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
InheritableStringParameterReferenceDefinition.DescriptorImpl
-
Nested classes/interfaces inherited from class hudson.plugins.project_inheritance.projects.parameters.InheritableStringParameterDefinition
InheritableStringParameterDefinition.IModes, 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 inherited from class hudson.plugins.project_inheritance.projects.parameters.InheritableStringParameterDefinition
variance
-
Fields inherited from class hudson.model.ParameterDefinition
LIST
-
-
Constructor Summary
Constructors Constructor Description InheritableStringParameterReferenceDefinition(InheritableStringParameterDefinition other)
InheritableStringParameterReferenceDefinition(String name, String defaultValue)
-
Method Summary
-
Methods inherited from class hudson.plugins.project_inheritance.projects.parameters.InheritableStringParameterDefinition
createValue, createValue, getDefaultParameterValue, getInheritanceMode, getLocationString, getLocationStringViaStapler, getMergeWithOther, getWhitespaceMode, 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, getDescriptor, getFormattedDescription, getName, getType, isValid
-
-
-
-
Constructor Detail
-
InheritableStringParameterReferenceDefinition
@DataBoundConstructor public InheritableStringParameterReferenceDefinition(String name, String defaultValue)
-
InheritableStringParameterReferenceDefinition
public InheritableStringParameterReferenceDefinition(InheritableStringParameterDefinition other)
-
-
Method Detail
-
initializeXStream
@Initializer(before=PLUGINS_STARTED) public static void initializeXStream()
-
getParent
public InheritableStringParameterDefinition getParent(InheritanceProject root)
This method returns theInheritableStringParameterDefinition
that is the parent of this reference, but is not a reference itself.As such, this method is useless if you want to compute the final value of the variable, but it is essential to find the value of the flags that can only be defined on a true parameter, like
getMustBeAssigned()
.- Parameters:
root
- the project that uses the current- Returns:
- the actual
InheritableStringParameterDefinition
that this reference ultimately points to. Skips all otherInheritableStringParameterReferenceDefinition
in between them.
-
getParent
public InheritableStringParameterDefinition getParent()
This works likegetParent(InheritanceProject)
, only that it tries to grab the current Project from the current stapler request.If it can't, null is returned. This means that this method will only work when called from a UI call and at no other time.
- Returns:
- the definition this reference points to, or null in case of the project or reference not being found.
-
copyWithDefaultValue
public ParameterDefinition copyWithDefaultValue(ParameterValue defaultValue)
Description copied from class:InheritableStringParameterDefinition
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:
InheritableStringParameterDefinition.getMergeWithOther(ParameterDefinition)
.- Overrides:
copyWithDefaultValue
in classInheritableStringParameterDefinition
- Parameters:
defaultValue
- the value to be assigned to the copy as a default. Must be aStringParameterValue
.
-
getMustHaveDefaultValue
public boolean getMustHaveDefaultValue()
Will fetch that field from its nearest parent; using the rootProperty- Overrides:
getMustHaveDefaultValue
in classInheritableStringParameterDefinition
-
getMustBeAssigned
public boolean getMustBeAssigned()
- Overrides:
getMustBeAssigned
in classInheritableStringParameterDefinition
-
getInheritanceModeAsVar
public InheritableStringParameterDefinition.IModes getInheritanceModeAsVar()
- Overrides:
getInheritanceModeAsVar
in classInheritableStringParameterDefinition
-
getDescription
public String getDescription()
- Overrides:
getDescription
in classParameterDefinition
-
getIsHidden
public boolean getIsHidden()
- Overrides:
getIsHidden
in classInheritableStringParameterDefinition
-
getWhitespaceModeAsVar
public InheritableStringParameterDefinition.WhitespaceMode getWhitespaceModeAsVar()
- Overrides:
getWhitespaceModeAsVar
in classInheritableStringParameterDefinition
-
-