Class AbstractMapConfigurationValueProvider

java.lang.Object
liquibase.configuration.AbstractConfigurationValueProvider
liquibase.configuration.AbstractMapConfigurationValueProvider
All Implemented Interfaces:
ConfigurationValueProvider
Direct Known Subclasses:
CommandLineArgumentValueProvider, DefaultsFileValueProvider, DeprecatedConfigurationValueProvider, EnvironmentValueProvider, FlowCommandArgumentValueProvider, LiquibaseSdkConfigurationValueProvider, SystemPropertyValueProvider

public abstract class AbstractMapConfigurationValueProvider extends AbstractConfigurationValueProvider
Convenience class for ConfigurationValueProviders that can collect the possible values into a Map. By default, it will follow standardized fuzzy-matching rules including being case insensitive, checking camelCase and kabob-case, etc.
See Also:
  • Constructor Details

    • AbstractMapConfigurationValueProvider

      public AbstractMapConfigurationValueProvider()
  • Method Details

    • getMap

      protected abstract Map<?,?> getMap()
    • getSourceDescription

      protected abstract String getSourceDescription()
    • getProvidedValue

      public ProvidedValue getProvidedValue(String... keyAndAliases)
      Default implementation stores a cache of found known values, falling back to lookupProvidedValue(String...) when it is asked about a new key. Uses getMapHash() to determine if the underlying map has changed.
      Parameters:
      keyAndAliases - an array of keys to check, where the first element is the canonical key name, any aliases for that key as later elements.
      Returns:
      null if the key is not defined in this provider.
    • getMapHash

      protected int getMapHash()
      Used by getProvidedValue(String...) to determine if the underlying data has changed vs. the cached results.
    • lookupProvidedValue

      protected ProvidedValue lookupProvidedValue(String... keyAndAliases)
      Finds the given key in the result of getMap() using keyMatches(String, String) to determine key equality. Subclasses should usually override this method rather than getProvidedValue(String...) so the caching functionality is not lost.
    • isValueSet

      protected boolean isValueSet(Object value)
      Used by ConfigurationValueProvider.getProvidedValue(String[]) to determine if the given value is a "real" value. This implementation returns false if value is null or if it is an empty string
    • keyMatches

      protected boolean keyMatches(String wantedKey, String storedKey)
      Used by ConfigurationValueProvider.getProvidedValue(String[]) to determine of a given map entry matches the wanted key. This implementation compares the values case-insensitively, and will replace camelCase words with kabob-case
      Parameters:
      wantedKey - the configuration key requested
      storedKey - the key stored in the map