public class Configuration
extends java.util.Observable
implements java.lang.Cloneable
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ARRAYSEP |
static java.lang.String |
FIELDSEP |
Constructor and Description |
---|
Configuration() |
Modifier and Type | Method and Description |
---|---|
void |
clear()
clears all properties.
|
boolean |
getBool(Key key)
Returns a
boolean property (case insensitiv), e.g. |
int |
getInt(Key key)
Parse an integer property and translate the String
"inf" into Integer.MAX_VALUE. |
java.nio.file.Path |
getPath(Key key)
Returns a
Path property, e.g. |
java.util.Properties |
getPropertiesCopy()
Return a copy of all properties.
|
java.lang.String |
getProperty(java.lang.String key)
Retrieves the value for key.
|
java.lang.String[] |
getStringArray(Key key)
Returns
String[] from a property. |
java.lang.String[][] |
getStringArrayArray(Key key)
Returns
String[][] from a property. |
java.net.URL |
getUrl(Key key)
Returns a
URL property, e.g. |
void |
load(java.io.InputStream fis)
Loads properties from the given stream.
|
void |
putAll(java.util.Properties allProps)
Add all given properties.
|
void |
setProperty(java.lang.String key,
java.lang.String value)
Sets the value for key.
|
void |
setWatchableSourceAndLoad(java.nio.file.Path confPath)
Load the configuration from the given path and start monitoring changes.
|
int |
size()
Count of properties.
|
public static final java.lang.String FIELDSEP
public static final java.lang.String ARRAYSEP
public void setWatchableSourceAndLoad(java.nio.file.Path confPath) throws ConfigurationException
ConfigurationException
public java.util.Properties getPropertiesCopy()
public void load(java.io.InputStream fis) throws java.io.IOException
java.io.IOException
public java.lang.String getProperty(java.lang.String key)
public void setProperty(java.lang.String key, java.lang.String value)
public void clear()
public void putAll(java.util.Properties allProps)
public int size()
public java.lang.String[][] getStringArrayArray(Key key) throws ConfigurationException
String[][]
from a property. Commas seperate array elements
and semicolons separate arrays, e.g.,
propertyname = a1, a2, a3; b1, b2, b3
ConfigurationException
public java.lang.String[] getStringArray(Key key) throws ConfigurationException
String[]
from a property. Commas seperate array elements,
e.g.,
propertyname = a1, a2, a3
ConfigurationException
public boolean getBool(Key key) throws ConfigurationException
boolean
property (case insensitiv), e.g.
propertyOne = True
.ConfigurationException
public int getInt(Key key) throws ConfigurationException
"inf"
into Integer.MAX_VALUE.
Verifies that this enum is a Key for an integer value.ConfigurationException
public java.nio.file.Path getPath(Key key) throws ConfigurationException
Path
property, e.g.
pathProperty = /my/path/file
.ConfigurationException
public java.net.URL getUrl(Key key) throws ConfigurationException
URL
property, e.g.
urlProperty = https://my.url.here
.ConfigurationException