Package liquibase.configuration
Class ConfigurationDefinition<DataType>
- java.lang.Object
-
- liquibase.configuration.ConfigurationDefinition<DataType>
-
- All Implemented Interfaces:
Comparable<ConfigurationDefinition<DataType>>
public class ConfigurationDefinition<DataType> extends Object implements Comparable<ConfigurationDefinition<DataType>>
A higher-level/detailed definition to provide type-safety, metadata, default values, etc.. Any code that is working with configurations should be using an instance of this class, rather than the lower-level, genericLiquibaseConfiguration
ConfigurationDefinitions that are registered with
LiquibaseConfiguration.registerDefinition(ConfigurationDefinition)
will be available in generated help etc.These objects are immutable, so to construct definitions, use
ConfigurationDefinition.Builder
The definition keys should be dot-separated, camelCased names, using a unique "namespace" as part of it. For example:
yourCorp.yourProperty
oryourCorp.sub.otherProperty
. Liquibase uses "liquibase" as the base namespace likeliquibase.shouldRun
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ConfigurationDefinition.Builder
Used to construct newConfigurationDefinition
instances.static class
ConfigurationDefinition.Building<DataType>
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(ConfigurationDefinition o)
boolean
equals(Object o)
boolean
equalsKey(String key)
Return true if the given key matches this definition.Set<String>
getAliasKeys()
boolean
getCommonlyUsed()
Returns true if this is configuration users are often interested in setting.ConfiguredValue<DataType>
getCurrentConfiguredValue()
ConfiguredValue<DataType>
getCurrentConfiguredValue(ConfigurationValueProvider... additionalValueProviders)
DataType
getCurrentValue()
Convenience method aroundgetCurrentConfiguredValue(ConfigurationValueProvider...)
to return the value.DataType
getCurrentValueObfuscated()
Convenience method aroundgetCurrentConfiguredValue(ConfigurationValueProvider...)
to return the obfuscated version of the value.Class<DataType>
getDataType()
DataType
getDefaultValue()
The default value used by this definition if no value is currently configured.String
getDefaultValueDescription()
A description of the default value.String
getDescription()
A user-friendly description of this definition.String
getKey()
The standard configuration key for this definition.ConfigurationValueConverter<DataType>
getValueConverter()
int
hashCode()
boolean
isHidden()
Return true if this configuration should not be printed to the console for any help command.boolean
isInternal()
Return true if this configuration is for internal and/or programmatic use only.
-
-
-
Method Detail
-
getCurrentValue
public DataType getCurrentValue()
Convenience method aroundgetCurrentConfiguredValue(ConfigurationValueProvider...)
to return the value.
-
getValueConverter
public ConfigurationValueConverter<DataType> getValueConverter()
-
getCurrentValueObfuscated
public DataType getCurrentValueObfuscated()
Convenience method aroundgetCurrentConfiguredValue(ConfigurationValueProvider...)
to return the obfuscated version of the value.- Returns:
- the obfuscated value, or the plain-text value if no obfuscator is defined for this definition.
-
getCurrentConfiguredValue
public ConfiguredValue<DataType> getCurrentConfiguredValue()
- Returns:
- Full details on the current value for this definition.
Will always return a
ConfiguredValue
,
-
getCurrentConfiguredValue
public ConfiguredValue<DataType> getCurrentConfiguredValue(ConfigurationValueProvider... additionalValueProviders)
- Parameters:
additionalValueProviders
- additionalConfigurationValueProvider
s to use with higher priority than the ones registered inLiquibaseConfiguration
. The higher the array index, the higher the priority.- Returns:
- Full details on the current value for this definition.
Will always return a
ConfiguredValue
,
-
getKey
public String getKey()
The standard configuration key for this definition. See theConfigurationDefinition
class-level docs on key format.
-
getAliasKeys
public Set<String> getAliasKeys()
- Returns:
- alternate configuration keys to check for values. Used for backwards compatibility.
-
getDescription
public String getDescription()
A user-friendly description of this definition. This will be exposed to end-users in generated help.
-
getDefaultValue
public DataType getDefaultValue()
The default value used by this definition if no value is currently configured.NOTE: this is only used if none of the
ConfigurationValueProvider
s have a configuration for the property. Even if some return "null", that is still considered a provided value to use rather than this default.
-
getDefaultValueDescription
public String getDefaultValueDescription()
A description of the default value. Defaults toString.valueOf(Object)
ofgetDefaultValue()
but can be explicitly withCommandArgumentDefinition.Building.defaultValue(Object, String)
.
-
getCommonlyUsed
public boolean getCommonlyUsed()
Returns true if this is configuration users are often interested in setting. Used to simplify generated help by hiding less commonly used settings.
-
isInternal
public boolean isInternal()
Return true if this configuration is for internal and/or programmatic use only. End-user facing integrations should not expose internal configurations directly.
-
isHidden
public boolean isHidden()
Return true if this configuration should not be printed to the console for any help command.
-
compareTo
public int compareTo(ConfigurationDefinition o)
- Specified by:
compareTo
in interfaceComparable<DataType>
-
equalsKey
public boolean equalsKey(String key)
Return true if the given key matches this definition.
-
-