public class SimpleConfig extends Object
Modifier and Type | Field and Description |
---|---|
static char |
BLANK |
static char |
HASH |
protected File |
initializedFrom |
protected Map<String,String> |
keyValue |
Constructor and Description |
---|
SimpleConfig() |
Modifier and Type | Method and Description |
---|---|
void |
addKeyValuePair(String k,
String v)
For subsequent modification.
|
protected void |
checkNotThere(String key) |
File |
getConfigurationDataFile() |
protected double |
getDouble(String key)
Returns doublce value, throws exception if not parsable.
|
protected int |
getInteger(String key)
Returns integer value, throws exception if not parsable.
|
protected String |
getNotEmpty(String key)
Returns trimmed value, iff there is a key, and the value is not
empty, else null.
|
protected String |
getObligate(String key)
Throws IOException iff no entry with given key, else
returns trimmed value (which may have zero length).
|
protected Double |
getWithDefault(String key,
double def)
Delivers the default if no entry with the given key.
|
protected Integer |
getWithDefault(String key,
int def)
Delivers the default if no entry with the given key.
|
protected String |
getWithDefault(String key,
String def)
Delivers the default if no entry with the given key.
|
void |
init(File initfile)
Reads a file with key value pairs line per line and stores
key/value pairs into the map
keyValue . |
protected IllegalArgumentException |
noEntry(String key) |
void |
removeKey(String k)
For subsequent modification.
|
public static final char BLANK
public static final char HASH
protected File initializedFrom
protected IllegalArgumentException noEntry(String key)
protected String getObligate(String key) throws IllegalArgumentException
IllegalArgumentException
protected String getWithDefault(String key, String def)
protected Integer getWithDefault(String key, int def)
protected Double getWithDefault(String key, double def)
protected String getNotEmpty(String key)
protected int getInteger(String key)
protected double getDouble(String key)
protected void checkNotThere(String key)
public void removeKey(String k)
public File getConfigurationDataFile()
public void init(File initfile) throws IOException, FileNotFoundException, IllegalArgumentException
keyValue
.
String.trim()
and then further analysed as follows:
see also the complete user documentation .