public abstract class AbstractMapConfigurationValueProvider extends AbstractConfigurationValueProvider
ConfigurationValueProvider
s 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.keyMatches(String, String)
Constructor and Description |
---|
AbstractMapConfigurationValueProvider() |
Modifier and Type | Method and Description |
---|---|
protected abstract Map<?,?> |
getMap() |
protected int |
getMapHash()
Used by
getProvidedValue(String...) to determine if the underlying data has changed vs. |
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. |
protected abstract String |
getSourceDescription() |
protected boolean |
isValueSet(Object value)
Used by
ConfigurationValueProvider.getProvidedValue(String[]) to determine if the given value is a "real" value. |
protected boolean |
keyMatches(String wantedKey,
String storedKey)
Used by
ConfigurationValueProvider.getProvidedValue(String[]) to determine of a given map entry matches the wanted key. |
protected ProvidedValue |
lookupProvidedValue(String... keyAndAliases)
Finds the given key in the result of
getMap() using keyMatches(String, String) to determine key equality. |
validate
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getPrecedence
public AbstractMapConfigurationValueProvider()
protected abstract Map<?,?> getMap()
protected abstract String getSourceDescription()
public ProvidedValue getProvidedValue(String... keyAndAliases)
lookupProvidedValue(String...)
when it is asked about a new key.
Uses getMapHash()
to determine if the underlying map has changed.keyAndAliases
- an array of keys to check, where the first element is the canonical key name, any aliases for that key as later elements.protected int getMapHash()
getProvidedValue(String...)
to determine if the underlying data has changed vs. the cached results.protected ProvidedValue lookupProvidedValue(String... keyAndAliases)
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.protected boolean isValueSet(Object value)
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 stringprotected boolean keyMatches(String wantedKey, String storedKey)
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-casewantedKey
- the configuration key requestedstoredKey
- the key stored in the mapCopyright © 2022 Liquibase.org. All rights reserved.