public final class Config extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_CONFIG_NAME
the default name of the named config: the actual value is
"default". |
| Modifier and Type | Method and Description |
|---|---|
void |
add(String key,
String value)
Adds a key/value pair to a named configuration.
|
void |
clear()
Clears a config store.
|
String |
get(String key)
Returns a key/value from a named config.
|
String |
get(String key,
String def)
Returns a key/value from a named config.
|
Boolean |
getAsBoolean(String key,
Boolean def)
returns a key/value from a named config, parsed as Boolean.
|
Integer |
getAsInteger(String key,
Integer def)
returns a key/value from a named config, parsed as Integer.
|
Long |
getAsLong(String key,
Long def)
returns a key/value from a named config, parsed as Long.
|
Map<String,String> |
getAsMap(String key,
Map<String,String> def)
returns a key/value from a named config, parsed as a
Map<String, String>. |
static Config |
getConfig()
the configuration with default name.
|
static Config |
getConfig(String name) |
String |
getName()
This config name.
|
String |
toString() |
public static final String DEFAULT_CONFIG_NAME
"default".public static Config getConfig()
DEFAULT_CONFIG_NAME;public static Config getConfig(String name)
name - the name of the config.public String getName()
public void add(String key, String value)
key - the keyvalue - the valuepublic String get(String key)
key - the keypublic String get(String key, String def)
key - the keydef - the default value to return when a value for the key is not
present.public Long getAsLong(String key, Long def)
key - the keydef - the default value for value not existent or not parseablepublic Boolean getAsBoolean(String key, Boolean def)
key - the keydef - the default value for value not existent or not parseablepublic Integer getAsInteger(String key, Integer def)
key - the keydef - the default value for value not existent or not parseablepublic Map<String,String> getAsMap(String key, Map<String,String> def)
Map<String, String>.
Each line (separated by \n) in the value is parsed as name=value
and stored in the returned map.key - the keydef - the default map to return if key is not present in the config.public void clear()
Copyright © 2017 smartrics. All rights reserved.