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, 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 ConfigurationDefinition.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
  • Field Details

    • IS_REFERENCE_CONNECTION_SCOPE_KEY

      public static final String IS_REFERENCE_CONNECTION_SCOPE_KEY
      Scope key set to Boolean.TRUE while the reference connection of a two-connection command (e.g. diff / diff-changelog) is being opened. Reference-scoped definitions (see
      invalid reference
      Builder.Building#referenceScoped()
      ) resolve from their .reference. sibling key while this is set. Unset (the primary connection and every single-connection command) preserves the standard resolution.
      See Also:
    • REFERENCE_DEFAULT_SENTINEL

      public static final String REFERENCE_DEFAULT_SENTINEL
      Value of a .reference. sibling key that explicitly opts the reference connection out of an inherited mechanism, resolving the definition as if unset (i.e. to its default). Case-insensitive.
      See Also:
  • Method Details

    • getCurrentValue

      public DataType getCurrentValue()
      Convenience method around getCurrentConfiguredValue(ConfigurationValueProvider...) to return the value.
    • getValueConverter

      public ConfigurationValueConverter<DataType> getValueConverter()
    • getCurrentValueObfuscated

      public DataType getCurrentValueObfuscated()
      Convenience method around getCurrentConfiguredValue(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 - additional ConfigurationValueProviders to use with higher priority than the ones registered in LiquibaseConfiguration. 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 the ConfigurationDefinition class-level docs on key format.
    • getAliasKeys

      public Set<String> getAliasKeys()
      Returns:
      alternate configuration keys to check for values. Used for backwards compatibility.
    • getDataType

      public Class<DataType> getDataType()
      Returns:
      the type of data this definition returns.
    • 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 to String.valueOf(Object) of getDefaultValue() but can be explicitly with CommandArgumentDefinition.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 interface Comparable<DataType>
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equalsKey

      public boolean equalsKey(String key)
      Return true if the given key matches this definition.