Package liquibase.command
Class CommandArgumentDefinition<DataType>
- java.lang.Object
-
- liquibase.command.CommandArgumentDefinition<DataType>
-
- All Implemented Interfaces:
Comparable<CommandArgumentDefinition<?>>
public class CommandArgumentDefinition<DataType> extends Object implements Comparable<CommandArgumentDefinition<?>>
Defines a known, type-safe argument for a specificCommandStep
. Includes metadata about the argument such as a description, if it is required, a default value, etc.Because this definition is tied to a specific step, multiple steps in a pipeline can define arguments of the same name.
- See Also:
for constructing new instances.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CommandArgumentDefinition.Building<DataType>
A newCommandArgumentDefinition
under construction fromCommandBuilder
-
Constructor Summary
Constructors Modifier Constructor Description protected
CommandArgumentDefinition(String name, Class<DataType> type)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(CommandArgumentDefinition<?> o)
boolean
equals(Object o)
SortedSet<String>
getAliases()
Aliases for the argument.Class<DataType>
getDataType()
The datatype this argument will return.DataType
getDefaultValue()
The default value to use for this argumentString
getDefaultValueDescription()
A description of the default value.String
getDescription()
The description of the argument.boolean
getHidden()
Hidden arguments are ones that can be called via integrations, but should not be normally shown in help to users.String
getName()
The name of the argument.CommandArgumentDefinition<?>
getSupersededBy()
ConfigurationValueConverter<DataType>
getValueConverter()
Function for converting values set in underlyingConfigurationValueProvider
s into the type needed for this command.ConfigurationValueObfuscator<DataType>
getValueObfuscator()
Used when sending the value to user output to protect secure values.int
hashCode()
boolean
isRequired()
Whether this argument is required.void
setSupersededBy(CommandArgumentDefinition<?> supersededBy)
String
toString()
void
validate(CommandScope commandScope)
Validates that the value stored in the givenCommandScope
is valid.
-
-
-
Method Detail
-
getName
public String getName()
The name of the argument. Must be camelCase alphanumeric.
-
getAliases
public SortedSet<String> getAliases()
Aliases for the argument. Must be camelCase alphanumeric.
-
getDescription
public String getDescription()
The description of the argument. Used in generated help documentation.
-
isRequired
public boolean isRequired()
Whether this argument is required. Exposed as a separate setting for help doc purposes.validate(CommandScope)
will ensure required values are set.
-
getSupersededBy
public CommandArgumentDefinition<?> getSupersededBy()
-
setSupersededBy
public void setSupersededBy(CommandArgumentDefinition<?> supersededBy)
-
getHidden
public boolean getHidden()
Hidden arguments are ones that can be called via integrations, but should not be normally shown in help to users.
-
getDefaultValue
public DataType getDefaultValue()
The default value to use for this argument
-
getDefaultValueDescription
public String getDefaultValueDescription()
A description of the default value. Defaults toString.valueOf(Object)
ofgetDefaultValue()
but can be explicitly withCommandArgumentDefinition.Building.defaultValue(Object, String)
.
-
getValueConverter
public ConfigurationValueConverter<DataType> getValueConverter()
Function for converting values set in underlyingConfigurationValueProvider
s into the type needed for this command.
-
getValueObfuscator
public ConfigurationValueObfuscator<DataType> getValueObfuscator()
Used when sending the value to user output to protect secure values.
-
validate
public void validate(CommandScope commandScope) throws CommandValidationException
Validates that the value stored in the givenCommandScope
is valid.- Throws:
CommandValidationException
- if the stored value is not valid.
-
compareTo
public int compareTo(CommandArgumentDefinition<?> o)
- Specified by:
compareTo
in interfaceComparable<DataType>
-
-