Top Description Inners Fields Constructors Methods
liquibase.configuration

public Class ConfigurationDefinition<DataType>

extends Object
implements Comparable<ConfigurationDefinition<DataType>>
Class Inheritance
All Implemented Interfaces
java.lang.Comparable
Imports
liquibase.Scope, liquibase.command.CommandArgumentDefinition, liquibase.util.ObjectUtil, .StringUtil, .ValueHandlerUtil, java.util.*, java.util.concurrent.atomic.AtomicReference, java.util.regex.Pattern

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, generic LiquibaseConfiguration

ConfigurationDefinitions that are registered with LiquibaseConfiguration#registerDefinition(ConfigurationDefinition) will be available in generated help etc.

These objects are immutable, so to construct definitions, use Builder

The definition keys should be dot-separated, camelCased names, using a unique "namespace" as part of it. For example:

yourCorp.yourProperty
or
yourCorp.sub.otherProperty
. Liquibase uses "liquibase" as the base namespace like
liquibase.shouldRun

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
public static class
private static class
ConfigurationDefinition.ConvertedValueProvider<DataType>

Used to track configuration values converted by a handler

pack-priv static class
ConfigurationDefinition.DefaultValueProvider

Used to track configuration values set by a default

Field Summary

Modifier and TypeField and Description
private final Set<String>
private static final Pattern
private static final String
private boolean
private final Class<DataType>
private DataType
private String
private String
private boolean
private boolean
private final String
private boolean
private ConfigurationValueConverter<DataType>
private ConfigurationValueObfuscator<DataType>

Constructor Summary

AccessConstructor and Description
private
ConfigurationDefinition(String key, Class<DataType> dataType)

Constructor private to force Builder usage

Method Summary

Modifier and TypeMethod and Description
public int
compareTo(ConfigurationDefinition<DataType>
the object to be compared.
o
)

Implements java.lang.Comparable.compareTo.

Compares this object with the specified object for order.

public boolean
equals(Object
the reference object with which to compare.
o
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public boolean
equalsKey(String key)

Return true if the given key matches this definition.

public Set<String>

Returns:

alternate configuration keys to check for values. Used for backwards compatibility.
getAliasKeys
()

public boolean
getCommonlyUsed()

Returns true if this is configuration users are often interested in setting.

public ConfiguredValue<DataType>

Returns:

Full details on the current value for this definition. Will always return a ConfiguredValue,
getCurrentConfiguredValue
()

public ConfiguredValue<DataType>

Returns:

Full details on the current value for this definition. Will always return a ConfiguredValue,
getCurrentConfiguredValue
(ConfigurationValueProvider...
additional ConfigurationValueProviders to use with higher priority than the ones registered in LiquibaseConfiguration. The higher the array index, the higher the priority.
additionalValueProviders
)

public DataType
getCurrentValue()

Convenience method around getCurrentConfiguredValue(ConfigurationValueProvider...) to return the value.

public DataType

Returns:

the obfuscated value, or the plain-text value if no obfuscator is defined for this definition.
getCurrentValueObfuscated
()

Convenience method around getCurrentConfiguredValue(ConfigurationValueProvider...) to return the obfuscated version of the value.

public Class<DataType>

Returns:

the type of data this definition returns.
getDataType
()

public DataType
getDefaultValue()

The default value used by this definition if no value is currently configured.

public String
getDefaultValueDescription()

A description of the default value.

public String
getDescription()

A user-friendly description of this definition.

public String
getKey()

The standard configuration key for this definition.

public ConfigurationValueConverter<DataType>
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public boolean
isHidden()

Return true if this configuration should not be printed to the console for any help command.

public boolean
isInternal()

Return true if this configuration is for internal and/or programmatic use only.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAlltoStringwaitwaitwait

Field Detail

aliasKeysback to summary
private final Set<String> aliasKeys
ALLOWED_KEY_PATTERNback to summary
private static final Pattern ALLOWED_KEY_PATTERN
ALLOWED_KEY_REGEXback to summary
private static final String ALLOWED_KEY_REGEX
commonlyUsedback to summary
private boolean commonlyUsed
dataTypeback to summary
private final Class<DataType> dataType
defaultValueback to summary
private DataType defaultValue
defaultValueDescriptionback to summary
private String defaultValueDescription
descriptionback to summary
private String description
hiddenback to summary
private boolean hidden
internalback to summary
private boolean internal
keyback to summary
private final String key
loggedUsingDefaultback to summary
private boolean loggedUsingDefault
valueConverterback to summary
private ConfigurationValueConverter<DataType> valueConverter
valueObfuscatorback to summary
private ConfigurationValueObfuscator<DataType> valueObfuscator

Constructor Detail

ConfigurationDefinitionback to summary
private ConfigurationDefinition(String key, Class<DataType> dataType) throws IllegalArgumentException

Constructor private to force Builder usage

Exceptions
IllegalArgumentException:
if an invalid key is specified.

Method Detail

compareToback to summary
public int compareTo(ConfigurationDefinition<DataType> o)

Implements java.lang.Comparable.compareTo.

Doc from java.lang.Comparable.compareTo.

Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

The implementor must ensure signum(x.compareTo(y)) == -signum(y.compareTo(x)) for all x and y. (This implies that x.compareTo(y) must throw an exception if and only if y.compareTo(x) throws an exception.)

The implementor must also ensure that the relation is transitive: (x.compareTo(y) > 0 && y.compareTo(z) > 0) implies x.compareTo(z) > 0.

Finally, the implementor must ensure that x.compareTo(y)==0 implies that signum(x.compareTo(z)) == signum(y.compareTo(z)), for all z.

Parameters
o:ConfigurationDefinition<DataType>

the object to be compared.

Returns:int

a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

Annotations
@Override
equalsback to summary
public boolean equals(Object o)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
o:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
equalsKeyback to summary
public boolean equalsKey(String key)

Return true if the given key matches this definition.

getAliasKeysback to summary
public Set<String> getAliasKeys()
Returns:Set<String>

alternate configuration keys to check for values. Used for backwards compatibility.

getCommonlyUsedback to summary
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.

getCurrentConfiguredValueback to summary
public ConfiguredValue<DataType> getCurrentConfiguredValue()
Returns:ConfiguredValue<DataType>

Full details on the current value for this definition. Will always return a ConfiguredValue,

getCurrentConfiguredValueback to summary
public ConfiguredValue<DataType> getCurrentConfiguredValue(ConfigurationValueProvider... additionalValueProviders)
Parameters
additionalValueProviders:ConfigurationValueProvider[]

additional ConfigurationValueProviders to use with higher priority than the ones registered in LiquibaseConfiguration. The higher the array index, the higher the priority.

Returns:ConfiguredValue<DataType>

Full details on the current value for this definition. Will always return a ConfiguredValue,

getCurrentValueback to summary
public DataType getCurrentValue()

Convenience method around getCurrentConfiguredValue(ConfigurationValueProvider...) to return the value.

getCurrentValueObfuscatedback to summary
public DataType getCurrentValueObfuscated()

Convenience method around getCurrentConfiguredValue(ConfigurationValueProvider...) to return the obfuscated version of the value.

Returns:DataType

the obfuscated value, or the plain-text value if no obfuscator is defined for this definition.

getDataTypeback to summary
public Class<DataType> getDataType()
Returns:Class<DataType>

the type of data this definition returns.

getDefaultValueback to summary
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.

getDefaultValueDescriptionback to summary
public String getDefaultValueDescription()

A description of the default value. Defaults to String#valueOf(Object) of getDefaultValue() but can be explicitly with CommandArgumentDefinition.Building#defaultValue(Object, String).

getDescriptionback to summary
public String getDescription()

A user-friendly description of this definition. This will be exposed to end-users in generated help.

getKeyback to summary
public String getKey()

The standard configuration key for this definition. See the ConfigurationDefinition class-level docs on key format.

getValueConverterback to summary
public ConfigurationValueConverter<DataType> getValueConverter()
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override
isHiddenback to summary
public boolean isHidden()

Return true if this configuration should not be printed to the console for any help command.

isInternalback to summary
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.

liquibase.configuration back to summary

public Class ConfigurationDefinition.Builder

extends Object
Class Inheritance

Used to construct new ConfigurationDefinition instances.

Field Summary

Modifier and TypeField and Description
private final String

Constructor Summary

AccessConstructor and Description
public
Builder(String
the prefix to add to new keys that are not fully qualified
defaultKeyPrefix
)

Method Summary

Modifier and TypeMethod and Description
public <T> ConfigurationDefinition.Building<T>
define(String key, Class<T> dataType)

Starts a new definition with the given key.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

defaultKeyPrefixback to summary
private final String defaultKeyPrefix

Constructor Detail

Builderback to summary
public Builder(String defaultKeyPrefix)
Parameters
defaultKeyPrefix:String

the prefix to add to new keys that are not fully qualified

Method Detail

defineback to summary
public <T> ConfigurationDefinition.Building<T> define(String key, Class<T> dataType)

Starts a new definition with the given key. Always adds the defaultKeyPrefix.

liquibase.configuration back to summary

public Class ConfigurationDefinition.Building<DataType>

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final String
private final ConfigurationDefinition<DataType>

Constructor Summary

AccessConstructor and Description
private
Building(ConfigurationDefinition<DataType> definition, String defaultKeyPrefix)

Method Summary

Modifier and TypeMethod and Description
public ConfigurationDefinition.Building<DataType>
public ConfigurationDefinition.Building<DataType>
public ConfigurationDefinition<DataType>
build()

Finishes building this definition AND registers it with LiquibaseConfiguration#registerDefinition(ConfigurationDefinition).

public ConfigurationDefinition<DataType>
buildTemporary()

Finishes building this definition WITHOUT registering it with LiquibaseConfiguration#registerDefinition(ConfigurationDefinition).

public ConfigurationDefinition.Building<DataType>
setCommonlyUsed(boolean commonlyUsed)

public ConfigurationDefinition.Building<DataType>
setDefaultValue(DataType defaultValue, String defaultValueDescription)

public ConfigurationDefinition.Building<DataType>
setDefaultValue(DataType defaultValue)

public ConfigurationDefinition.Building<DataType>
setDescription(String description)

public ConfigurationDefinition.Building<DataType>
setHidden(boolean hidden)

public ConfigurationDefinition.Building<DataType>
setInternal(boolean internal)

public ConfigurationDefinition.Building<DataType>
public ConfigurationDefinition.Building<DataType>
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

defaultKeyPrefixback to summary
private final String defaultKeyPrefix
definitionback to summary
private final ConfigurationDefinition<DataType> definition

Constructor Detail

Buildingback to summary
private Building(ConfigurationDefinition<DataType> definition, String defaultKeyPrefix)

Method Detail

addAliasesback to summary
public ConfigurationDefinition.Building<DataType> addAliases(Collection<String> aliases)
addAliasKeyback to summary
public ConfigurationDefinition.Building<DataType> addAliasKey(String alias)
buildback to summary
public ConfigurationDefinition<DataType> build()

Finishes building this definition AND registers it with LiquibaseConfiguration#registerDefinition(ConfigurationDefinition). To not register this definition, use buildTemporary()

buildTemporaryback to summary
public ConfigurationDefinition<DataType> buildTemporary()

Finishes building this definition WITHOUT registering it with LiquibaseConfiguration#registerDefinition(ConfigurationDefinition). To automatically register this definition, use build()

setCommonlyUsedback to summary
public ConfigurationDefinition.Building<DataType> setCommonlyUsed(boolean commonlyUsed)
setDefaultValueback to summary
public ConfigurationDefinition.Building<DataType> setDefaultValue(DataType defaultValue, String defaultValueDescription)
setDefaultValueback to summary
public ConfigurationDefinition.Building<DataType> setDefaultValue(DataType defaultValue)
setDescriptionback to summary
public ConfigurationDefinition.Building<DataType> setDescription(String description)
setHiddenback to summary
public ConfigurationDefinition.Building<DataType> setHidden(boolean hidden)
setInternalback to summary
public ConfigurationDefinition.Building<DataType> setInternal(boolean internal)
setValueHandlerback to summary
public ConfigurationDefinition.Building<DataType> setValueHandler(ConfigurationValueConverter<DataType> handler)
setValueObfuscatorback to summary
public ConfigurationDefinition.Building<DataType> setValueObfuscator(ConfigurationValueObfuscator<DataType> handler)
liquibase.configuration back to summary

private final Class ConfigurationDefinition.ConvertedValueProvider<DataType>

extends AbstractConfigurationValueProvider
Class Inheritance

Used to track configuration values converted by a handler

Field Summary

Modifier and TypeField and Description
private final String
private final String
private final DataType

Constructor Summary

AccessConstructor and Description
public
ConvertedValueProvider(DataType value, ProvidedValue originalProvidedValue)

Method Summary

Modifier and TypeMethod and Description
public int
getPrecedence()

Implements liquibase.configuration.ConfigurationValueProvider.getPrecedence.

Returns the precedence of values returned by this provider.

public ProvidedValue
getProvidedValue(String...
an array of keys to check, where the first element is the canonical key name, any aliases for that key as later elements.
keyAndAliases
)

Implements liquibase.configuration.ConfigurationValueProvider.getProvidedValue.

Lookup the given key(s) in this source.

Inherited from liquibase.configuration.AbstractConfigurationValueProvider:
validate

Field Detail

actualKeyback to summary
private final String actualKey
originalSourceback to summary
private final String originalSource
valueback to summary
private final DataType value

Constructor Detail

ConvertedValueProviderback to summary
public ConvertedValueProvider(DataType value, ProvidedValue originalProvidedValue)

Method Detail

getPrecedenceback to summary
public int getPrecedence()

Implements liquibase.configuration.ConfigurationValueProvider.getPrecedence.

Doc from liquibase.configuration.ConfigurationValueProvider.getPrecedence.

Returns the precedence of values returned by this provider. Higher a provider with higher precedence overrides values from lower precedence providers.

Standard provider precedence:

Annotations
@Override
getProvidedValueback to summary
public ProvidedValue getProvidedValue(String... keyAndAliases)

Implements liquibase.configuration.ConfigurationValueProvider.getProvidedValue.

Doc from liquibase.configuration.ConfigurationValueProvider.getProvidedValue.

Lookup the given key(s) in this source. It is up to the implementation to provide any "smoothing" or translation of key names. For example, an EnvironmentValueProvider will look check environment variables containing _'s rather than .'s.

Parameters
keyAndAliases:String[]

an array of keys to check, where the first element is the canonical key name, any aliases for that key as later elements.

Returns:ProvidedValue

null if the key is not defined in this provider.

Annotations
@Override
liquibase.configuration back to summary

pack-priv final Class ConfigurationDefinition.DefaultValueProvider

extends AbstractConfigurationValueProvider
Class Inheritance

Used to track configuration values set by a default

Field Summary

Modifier and TypeField and Description
private final Object

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public int
getPrecedence()

Implements liquibase.configuration.ConfigurationValueProvider.getPrecedence.

Returns the precedence of values returned by this provider.

public ProvidedValue
getProvidedValue(String...
an array of keys to check, where the first element is the canonical key name, any aliases for that key as later elements.
keyAndAliases
)

Implements liquibase.configuration.ConfigurationValueProvider.getProvidedValue.

Lookup the given key(s) in this source.

Inherited from liquibase.configuration.AbstractConfigurationValueProvider:
validate

Field Detail

valueback to summary
private final Object value

Constructor Detail

DefaultValueProviderback to summary
public DefaultValueProvider(Object value)

Method Detail

getPrecedenceback to summary
public int getPrecedence()

Implements liquibase.configuration.ConfigurationValueProvider.getPrecedence.

Doc from liquibase.configuration.ConfigurationValueProvider.getPrecedence.

Returns the precedence of values returned by this provider. Higher a provider with higher precedence overrides values from lower precedence providers.

Standard provider precedence:

Annotations
@Override
getProvidedValueback to summary
public ProvidedValue getProvidedValue(String... keyAndAliases)

Implements liquibase.configuration.ConfigurationValueProvider.getProvidedValue.

Doc from liquibase.configuration.ConfigurationValueProvider.getProvidedValue.

Lookup the given key(s) in this source. It is up to the implementation to provide any "smoothing" or translation of key names. For example, an EnvironmentValueProvider will look check environment variables containing _'s rather than .'s.

Parameters
keyAndAliases:String[]

an array of keys to check, where the first element is the canonical key name, any aliases for that key as later elements.

Returns:ProvidedValue

null if the key is not defined in this provider.

Annotations
@Override