public class Config extends Object
.ini
files, where each file can
override values defined by the previous ones.Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_KEY_VALUE_SEPARATOR
Used in a string representation of a map; separates keys from values
|
static char |
DEFAULT_PAIR_SEPARATOR
Used in a string representation of a map; separates pairs of value
|
Constructor and Description |
---|
Config()
Convenience constructor to create an empty config.
|
Config(RawConfig rawConfig) |
Config(RawConfig rawConfig,
com.google.common.collect.ImmutableMap<Path,RawConfig> configsMap) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
com.google.common.collect.ImmutableMap<String,String> |
get(String sectionName) |
Optional<String> |
get(String section,
String field) |
Optional<Boolean> |
getBoolean(String sectionName,
String propertyName) |
boolean |
getBooleanValue(String sectionName,
String propertyName,
boolean defaultValue) |
com.google.common.collect.ImmutableMap<Path,RawConfig> |
getConfigsMap()
A map of Paths to the RawConfig that came from that config file.
|
<T extends Enum<T>> |
getEnum(String section,
String field,
Class<T> clazz) |
Optional<Float> |
getFloat(String sectionName,
String propertyName) |
OptionalInt |
getInteger(String sectionName,
String propertyName) |
com.google.common.collect.ImmutableList<String> |
getListWithoutComments(String sectionName,
String propertyName) |
com.google.common.collect.ImmutableList<String> |
getListWithoutComments(String sectionName,
String propertyName,
char splitChar) |
Optional<Long> |
getLong(String sectionName,
String propertyName) |
com.google.common.collect.ImmutableMap<String,String> |
getMap(String section,
String field)
Convert a string representation of a map to a binary
ImmutableMap<String, String> ,
using default separators |
com.google.common.collect.ImmutableMap<String,String> |
getMap(String section,
String field,
char pairSeparatorChar,
String keyValueSeparator)
Convert a string representation of a map to a binary
ImmutableMap<String, String> |
Optional<com.google.common.collect.ImmutableList<String>> |
getOptionalListWithoutComments(String sectionName,
String propertyName)
ini4j leaves things that look like comments in the values of entries in the file.
|
Optional<com.google.common.collect.ImmutableList<String>> |
getOptionalListWithoutComments(String sectionName,
String propertyName,
char splitChar) |
com.google.common.hash.HashCode |
getOrderIndependentHashCode()
gets an order-independent
HashCode of this Config 's raw data. |
RawConfig |
getRawConfig() |
com.google.common.collect.ImmutableMap<String,com.google.common.collect.ImmutableMap<String,String>> |
getSectionToEntries() |
Optional<URI> |
getUrl(String section,
String field) |
Optional<String> |
getValue(String sectionName,
String propertyName) |
int |
hashCode() |
Config |
overrideWith(Config other) |
String |
toString() |
public static final char DEFAULT_PAIR_SEPARATOR
public static final String DEFAULT_KEY_VALUE_SEPARATOR
public Config()
public Config(RawConfig rawConfig)
public com.google.common.hash.HashCode getOrderIndependentHashCode()
HashCode
of this Config
's raw data.public com.google.common.collect.ImmutableMap<String,com.google.common.collect.ImmutableMap<String,String>> getSectionToEntries()
public com.google.common.collect.ImmutableList<String> getListWithoutComments(String sectionName, String propertyName)
ImmutableList
containing all entries that don't look like comments, or the
empty list if the property is not defined or there are no values.public com.google.common.collect.ImmutableList<String> getListWithoutComments(String sectionName, String propertyName, char splitChar)
public Optional<com.google.common.collect.ImmutableList<String>> getOptionalListWithoutComments(String sectionName, String propertyName)
ImmutableList
containing all entries that don't look like comments, the
empty list if the property is defined but there are no values, or Optional.empty() if the
property is not defined.public Optional<com.google.common.collect.ImmutableList<String>> getOptionalListWithoutComments(String sectionName, String propertyName, char splitChar)
public OptionalInt getInteger(String sectionName, String propertyName)
public boolean getBooleanValue(String sectionName, String propertyName, boolean defaultValue)
public <T extends Enum<T>> Optional<T> getEnum(String section, String field, Class<T> clazz)
public com.google.common.collect.ImmutableMap<String,String> getMap(String section, String field, char pairSeparatorChar, String keyValueSeparator)
ImmutableMap<String, String>
section
- Config file section namefield
- Config file value namepairSeparatorChar
- Character that separates pairs of keys and valueskeyValueSeparator
- String that separates keys and valuesImmutableMap
public com.google.common.collect.ImmutableMap<String,String> getMap(String section, String field)
ImmutableMap<String, String>
,
using default separatorssection
- Config file section namefield
- Config file value nameImmutableMap
public RawConfig getRawConfig()
public com.google.common.collect.ImmutableMap<Path,RawConfig> getConfigsMap()