Package ru.bgcrm.util
Class ParameterMap
- Direct Known Subclasses:
Preferences
Key - value strings map.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,
V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object, V extends Object> -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ConcurrentHashMap<Class<?>,
Config> Конфигурации, разбираются при первом обращении и кешируются далее.static ParameterMap
protected String
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionentrySet()
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 JSP and JEXL.Сериализация набора параметров в строку<ключ>=<значение> с переносами строк. getDataString
(String prefix) Сериализация набора параметров в строку<ключ>=<значение> с переносами строк. static final String
getDataString
(ParameterMap 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.static ParameterMap
Creates ParameterMap object from key values pairs.parseObjectsNoOrder
(String prefix) Deprecated.<K extends Config>
voidremoveConfig
(Class<K> clazz) Removes config from cache.Selects subset of parameters by key prefixes.subIndexed
(String... prefixes) Creates a new sorted sub-map with integer keys.Creates a new unsorted 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
-
configMap
Конфигурации, разбираются при первом обращении и кешируются далее. -
EMPTY
-
mapPrint
-
-
Constructor Details
-
ParameterMap
public ParameterMap()
-
-
Method Details
-
of
Creates ParameterMap object from key values pairs.- Parameters:
keyValues
- key1, value1,... String.valueOf() is applied to each argument.- Returns:
-
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. -
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:
prefixes
- prefixes for extraction.- Returns:
- never
null
. - See Also:
-
#subKeyed(String)
-
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:
-
#subIndexed(String)
-
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
-- Returns:
-
getConfig
Same withgetConfig(Class)
, but with string parameter for calling from JSP and JEXL.- Parameters:
className
-- Returns:
-
removeConfig
Removes config from cache.- Type Parameters:
K
-- Parameters:
clazz
-
-
validateConfig
Creates a configuration for validation purposes only..- Parameters:
clazz
-- Throws:
BGMessageException
-