Package liquibase.configuration
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 forConfigurationValueProviders 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:
keyMatches(String, String)
-
-
Constructor Summary
Constructors Constructor Description AbstractMapConfigurationValueProvider()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract Map<?,?>getMap()protected intgetMapHash()Used bygetProvidedValue(String...)to determine if the underlying data has changed vs.ProvidedValuegetProvidedValue(String... keyAndAliases)Default implementation stores a cache of found known values, falling back tolookupProvidedValue(String...)when it is asked about a new key.protected abstract StringgetSourceDescription()protected booleanisValueSet(Object value)Used byConfigurationValueProvider.getProvidedValue(String[])to determine if the given value is a "real" value.protected booleankeyMatches(String wantedKey, String storedKey)Used byConfigurationValueProvider.getProvidedValue(String[])to determine of a given map entry matches the wanted key.protected ProvidedValuelookupProvidedValue(String... keyAndAliases)Finds the given key in the result ofgetMap()usingkeyMatches(String, String)to determine key equality.-
Methods inherited from class liquibase.configuration.AbstractConfigurationValueProvider
validate
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface liquibase.configuration.ConfigurationValueProvider
getPrecedence
-
-
-
-
Method Detail
-
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 tolookupProvidedValue(String...)when it is asked about a new key. UsesgetMapHash()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 bygetProvidedValue(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 ofgetMap()usingkeyMatches(String, String)to determine key equality. Subclasses should usually override this method rather thangetProvidedValue(String...)so the caching functionality is not lost.
-
isValueSet
protected boolean isValueSet(Object value)
Used byConfigurationValueProvider.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 byConfigurationValueProvider.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 requestedstoredKey- the key stored in the map
-
-