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. |
long |
getLong(Key key)
Parse a long property.
|
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 |
getProperty(java.lang.String key,
java.lang.String def)
Retrieves the value for key returning a default for non-existing keys.
|
java.util.Set<SourceType> |
getSourceTypeSet(Key key)
Returns a
SourceType as List, e.g. |
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. |
java.net.URL[] |
getUrlArray(Key key)
Returns
URL[] from a property. |
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
ConfigurationExceptionpublic java.util.Properties getPropertiesCopy()
public void load(java.io.InputStream fis)
throws java.io.IOException
java.io.IOExceptionpublic java.lang.String getProperty(java.lang.String key)
public java.lang.String getProperty(java.lang.String key,
java.lang.String def)
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, b3ConfigurationExceptionpublic java.lang.String[] getStringArray(Key key) throws ConfigurationException
String[] from a property. Commas seperate array elements,
e.g.,
propertyname = a1, a2, a3ConfigurationExceptionpublic boolean getBool(Key key) throws ConfigurationException
boolean property (case insensitiv), e.g.
propertyOne = True.ConfigurationExceptionpublic int getInt(Key key) throws ConfigurationException
"inf" into Integer.MAX_VALUE.
Verifies that this enum is a Key for an integer value.ConfigurationExceptionpublic long getLong(Key key) throws ConfigurationException
ConfigurationExceptionpublic java.nio.file.Path getPath(Key key) throws ConfigurationException
Path property, e.g.
pathProperty = /my/path/file.ConfigurationExceptionpublic java.util.Set<SourceType> getSourceTypeSet(Key key) throws ConfigurationException
SourceType as List, e.g.
sourcetypeproperty = Remote, Sync.ConfigurationExceptionpublic java.net.URL getUrl(Key key) throws ConfigurationException
URL property, e.g.
urlProperty = https://my.url.here.ConfigurationExceptionpublic java.net.URL[] getUrlArray(Key key) throws ConfigurationException
URL[] from a property. Commas seperate array elements,
e.g.,
propertyname = a1.example.org, a2.example2.com, a3.example3.netConfigurationException