Package org.bgerp.app.cfg
Class ConfigMap
- Direct Known Subclasses:
Preferences
,SimpleConfigMap
Key - value strings map.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,
V>, AbstractMap.SimpleImmutableEntry<K, V> -
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
Clears all the parsed configurations fromconfigMap
.entrySet()
Deprecated.abstract String
getBigDecimal
(String key, BigDecimal def) final boolean
getBoolean
(String key) Retrieves by key a boolean value with defaultfalse
.final boolean
getBoolean
(String key, boolean defaultValue) Retrieves by key a boolean value.final <K extends Config>
KCreates if needed and gets pre parsed and cached configuration.final Object
Same withgetConfig(Class)
, but with string parameter for calling from scripts.Сериализация набора параметров в строку<ключ>=<значение> с переносами строк. getDataString
(String prefix) Сериализация набора параметров в строку<ключ>=<значение> с переносами строк. static final String
getDataString
(ConfigMap config) Deprecated.int
int
long
long
Retrieves by key value with support of old keys.Retrieves by key value with support of old keys.boolean
getSokBoolean
(boolean def, boolean validate, String... keys) Retrieves by key value with support of old keys.boolean
getSokBoolean
(boolean def, String... keys) Retrieves by key value with support of old keys.long
getSokLong
(long def, boolean validate, String... keys) Retrieves by key value with support of old keys.long
getSokLong
(long def, String... keys) Retrieves by key value with support of old keys.parseObjectsNoOrder
(String prefix) Deprecated.<K extends Config>
voidremoveConfig
(Class<K> clazz) Removes config from cache.Selects subset of parameters by key prefixes.subIndexed
(String prefix) Creates a new sorted sub-map with integer keys.Creates a new unsorted sub-map with integer keys.subSokIndexed
(String... prefixes) Creates a new sorted sub-map with integer keys.final <K extends Config>
voidvalidateConfig
(Class<K> clazz) Creates a configuration for validation purposes only..Methods inherited from class java.util.AbstractMap
clear, clone, containsKey, containsValue, equals, hashCode, isEmpty, keySet, put, putAll, remove, size, toString, values
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Field Details
-
EMPTY
-
-
Constructor Details
-
ConfigMap
public ConfigMap()
-
-
Method Details
-
get
-
get
-
getSok
Retrieves by key value with support of old keys.- Parameters:
def
- default value.validate
- throw an exception on using old keys.keys
- first key is the actual one, after - olds.- Returns:
- Throws:
BGMessageException
-
getSok
Retrieves by key value with support of old keys.- Parameters:
keys
- first key is the actual one, after - olds.- Returns:
-
getInt
-
getInt
-
getLong
-
getLong
-
getSokLong
Retrieves by key value with support of old keys.- Parameters:
def
- default value.validate
- throw an exception on using old keys.keys
- first key is the actual one, after - olds.- Returns:
- Throws:
BGMessageException
-
getSokLong
Retrieves by key value with support of old keys.- Parameters:
def
- default value.keys
- first key is the actual one, after - olds.- Returns:
- Throws:
BGMessageException
-
getBoolean
Retrieves by key a boolean value with defaultfalse
.- Parameters:
key
- the key.- Returns:
- See Also:
-
getBoolean
Retrieves by key a boolean value.- Parameters:
key
- the key.defaultValue
- default value.- Returns:
- 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 value.validate
- throw an exception on using old keys.keys
- first key is the actual one, after - olds.- Returns:
- Throws:
BGMessageException
-
getSokBoolean
Retrieves by key value with support of old keys.- Parameters:
def
- default value.keys
- first key is the actual one, after - olds.- Returns:
- Throws:
BGMessageException
-
getBigDecimal
-
entrySet
-
fingerprint
Deprecated. -
sub
Selects subset of parameters by key prefixes.- Parameters:
prefixes
- key prefixes.- Returns:
-
getDataString
Сериализация набора параметров в строку<ключ>=<значение> с переносами строк. - Returns:
-
getDataString
Сериализация набора параметров в строку<ключ>=<значение> с переносами строк. К каждой строке добавляется префикс. - Parameters:
prefix
-- Returns:
-
getDataString
Deprecated. -
subSokIndexed
Creates a new sorted sub-map with integer keys. With support of old prefixes.prefix.1.12=2 prefix.1.34=4 prefix.2.56=2 prefix.2.78=4 -> sorted
Map
1={12=2,34=4} 2={56=2,78=4}- Parameters:
prefixes
- prefixes for extraction, the first one is the actual, the rest are deprecated prefixes.- Returns:
- never
null
.
-
subIndexed
Creates a new sorted sub-map with integer keys.prefix.1.12=2 prefix.1.34=4 prefix.2.56=2 prefix.2.78=4 -> sorted
Map
1={12=2,34=4} 2={56=2,78=4}- Parameters:
prefix
- the prefix for extraction.- Returns:
- never
null
.
-
subKeyed
Creates a new unsorted sub-map with integer keys.prefix.a.12=2 prefix.a.34=4 prefix.b.56=2 prefix.b.78=4 -> unsorted map a={12=2,34=4} b={56=2,78=4}
- Parameters:
prefixes
- prefixes for extraction.- Returns:
- never
null
. - See Also:
-
parseObjectsNoOrder
Deprecated.- Parameters:
prefix
-- Returns:
-
getConfig
Creates if needed and gets pre parsed and cached configuration. Cache key - the class object of the configuration.- Parameters:
clazz
- the configuration class.- Returns:
-
getConfig
Same withgetConfig(Class)
, but with string parameter for calling from scripts. The method is less recommended asgetConfig(Class)
, which is checked by compiler.- Parameters:
className
- the full class name.- Returns:
-
removeConfig
Removes config from cache.- Type Parameters:
K
-- Parameters:
clazz
-
-
clearConfigs
protected void clearConfigs()Clears all the parsed configurations fromconfigMap
. -
validateConfig
Creates a configuration for validation purposes only..- Parameters:
clazz
-- Throws:
BGMessageException
-