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, genericLiquibaseConfigurationConfigurationDefinitions that are registered with
LiquibaseConfiguration.registerDefinition(ConfigurationDefinition)will be available in generated help etc.These objects are immutable, so to construct definitions, use
ConfigurationDefinition.BuilderThe 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 classConfigurationDefinition.BuilderUsed to construct newConfigurationDefinitioninstances.static classConfigurationDefinition.Building<DataType>
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(ConfigurationDefinition o)booleanequals(Object o)booleanequalsKey(String key)Return true if the given key matches this definition.Set<String>getAliasKeys()booleangetCommonlyUsed()Returns true if this is configuration users are often interested in setting.ConfiguredValue<DataType>getCurrentConfiguredValue()ConfiguredValue<DataType>getCurrentConfiguredValue(ConfigurationValueProvider... additionalValueProviders)DataTypegetCurrentValue()Convenience method aroundgetCurrentConfiguredValue(ConfigurationValueProvider...)to return the value.DataTypegetCurrentValueObfuscated()Convenience method aroundgetCurrentConfiguredValue(ConfigurationValueProvider...)to return the obfuscated version of the value.Class<DataType>getDataType()DataTypegetDefaultValue()The default value used by this definition if no value is currently configured.StringgetDefaultValueDescription()A description of the default value.StringgetDescription()A user-friendly description of this definition.StringgetKey()The standard configuration key for this definition.ConfigurationValueConverter<DataType>getValueConverter()inthashCode()booleanisHidden()Return true if this configuration should not be printed to the console for any help command.booleanisInternal()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- additionalConfigurationValueProviders 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 theConfigurationDefinitionclass-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
ConfigurationValueProviders 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:
compareToin interfaceComparable<DataType>
-
equalsKey
public boolean equalsKey(String key)
Return true if the given key matches this definition.
-
-