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,InteractivePromptingValueProvider,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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract Map<?,?> getMap()protected intUsed bygetProvidedValue(String...)to determine if the underlying data has changed vs. the cached results.getProvidedValue(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 Stringprotected 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
validateMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface liquibase.configuration.ConfigurationValueProvider
getPrecedence
-
Constructor Details
-
AbstractMapConfigurationValueProvider
public AbstractMapConfigurationValueProvider()
-
-
Method Details
-
getMap
-
getSourceDescription
-
getDescription
-
getProvidedValue
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
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
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
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
-