Class ConfigMap
- Direct Known Subclasses:
Preferences, SimpleConfigMap
Key - value strings map
-
Nested Class Summary
Nested classes/interfaces inherited from class AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K, V> -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidClears all the parsed configurations fromconfigMapentrySet()abstract StringgetBigDecimal(String key, BigDecimal def) final booleangetBoolean(String key) Retrieves by key a boolean value with defaultfalsefinal booleangetBoolean(String key, boolean defaultValue) Retrieves by key a boolean valuefinal <K extends Config>
KCreates if needed and gets pre parsed and cached configuration.final ObjectGets or creates the cached configuration for a class given by name, for calling from scripts.Serializes the data tokey=valuestring linesintintlonglongRetrieves by key value with support of old keysRetrieves by key value with support of old keysbooleangetSokBoolean(boolean def, boolean validate, String... keys) Retrieves by key value with support of old keysbooleangetSokBoolean(boolean def, String... keys) Retrieves by key value with support of old keyslonggetSokLong(long def, boolean validate, String... keys) Retrieves by key value with support of old keyslonggetSokLong(long def, String... keys) Retrieves by key value with support of old keys<K extends Config>
voidremoveConfig(Class<K> clazz) Removes config from cacheCreates a sub map by a key prefixsubIndexed(String prefix) Creates a sorted map of maps by a key prefixCreates a map of maps by a key prefixCreates a sub map by key prefixessubSokIndexed(String... prefixes) Creates a sorted map of maps by key prefixesfinal <K extends Config>
voidvalidateConfig(Class<K> clazz) Creates a configuration for validation purposes onlyMethods inherited from class AbstractMap
clear, clone, containsKey, containsValue, equals, hashCode, isEmpty, keySet, put, putAll, remove, size, toString, valuesMethods inherited from interface Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Field Details
-
EMPTY
-
-
Constructor Details
-
ConfigMap
public ConfigMap()
-
-
Method Details
-
get
-
entrySet
-
get
-
getSok
Retrieves by key value with support of old keys- Parameters:
def- default valuevalidate- throw an exception on using old keyskeys- first key is the actual one, after - olds- Returns:
- the found value, or
defif none of the keys are set - Throws:
BGMessageException
-
getSok
-
getInt
-
getInt
-
getLong
-
getLong
-
getSokLong
Retrieves by key value with support of old keys- Parameters:
def- default valuevalidate- throw an exception on using old keyskeys- first key is the actual one, after - olds- Returns:
- the found value, or
defif none of the keys are set - Throws:
BGMessageException
-
getSokLong
Retrieves by key value with support of old keys- Parameters:
def- default valuekeys- first key is the actual one, after - olds- Returns:
- the found value, or
defif none of the keys are set
-
getBoolean
Retrieves by key a boolean value with defaultfalse- Parameters:
key- the key- Returns:
- the found value, or
falseif not set - See Also:
-
getBoolean
Retrieves by key a boolean value- Parameters:
key- the keydefaultValue- default value- Returns:
- the found value, or
defaultValueif not set - See Also:
-
getSokBoolean
public boolean getSokBoolean(boolean def, boolean validate, String... keys) throws BGMessageException Retrieves by key value with support of old keys- Parameters:
def- default valuevalidate- throw an exception on using old keyskeys- first key is the actual one, after - olds- Returns:
- the found value, or
defif none of the keys are set - Throws:
BGMessageException
-
getSokBoolean
Retrieves by key value with support of old keys- Parameters:
def- default valuekeys- first key is the actual one, after - olds- Returns:
- the found value, or
defif none of the keys are set
-
getBigDecimal
-
sub
-
subSok
-
subIndexed
-
subSokIndexed
Creates a sorted map of maps by key prefixesprefix1.12=2 prefix1.34=4 prefix2.56=2 prefix2.78=4 -> sorted
Map1={12=2,34=4} 2={56=2,78=4}- Parameters:
prefixes- key prefixes for extraction, the first one is the actual, the rest are deprecated prefixes- Returns:
- not
nullmap
-
subKeyed
-
getConfig
-
getConfig
Gets or creates the cached configuration for a class given by name, for calling from scripts. Less recommended thangetConfig(Class), which is checked by the compiler.- Parameters:
className- the full class name- Returns:
- the configuration instance, or
nullif it couldn't be created
-
removeConfig
-
clearConfigs
protected void clearConfigs()Clears all the parsed configurations fromconfigMap -
validateConfig
Creates a configuration for validation purposes only- Parameters:
clazz-- Throws:
BGMessageException
-
getDataString
Serializes the data tokey=valuestring lines- Returns:
- the string with pairs on lines
-