|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.eclipse.stardust.common.config.Parameters
public abstract class Parameters
The JDK has various mechanisms to obtain environmental parameters such as system properties, resources etc. which are confusing to use. This class provides a homogenous mechanism to access all this information.
It is possible to store additional properties sets, being considered as a "chain of responsibilities" in a "last in-first considered" manner. Parameters are key/value-pairs. The name may be a list of identifiers separated by ".". The identifiers are considered case-insensitive.
| Nested Class Summary | |
|---|---|
static interface |
Parameters.IDisposable
|
| Constructor Summary | |
|---|---|
Parameters()
|
|
| Method Summary | ||
|---|---|---|
abstract void |
addProperties(String fileName)
There must be a a file " |
|
abstract void |
flush()
Resets the cached configuration, effectively enforcing a configuration reload when properties are retrieved the next time. |
|
abstract Object |
get(String name)
|
|
boolean |
getBoolean(String name,
boolean defaultValue)
|
|
Calendar |
getDate(String name)
We expect the format yyyy-mm-dd. |
|
Calendar |
getDate(String name,
Calendar defaultValue)
We expect the format yyyy-mm-dd. |
|
static String |
getDefaultProperties()
|
|
double |
getDouble(String name,
double defaultValue)
Gets the value of the property. |
|
int |
getInteger(String name,
int defaultValue)
Gets the value of the property. |
|
long |
getLong(String name,
long defaultValue)
|
|
|
getObject(String name)
|
|
|
getObject(String name,
T defaultValue)
|
|
String |
getString(String name)
Gets the value of the property. |
|
String |
getString(String name,
String defaultValue)
Gets the value of the property. |
|
List<String> |
getStrings(String name)
|
|
List<String> |
getStrings(String name,
String separators)
Returns a list of values. |
|
static Parameters |
instance()
|
|
abstract void |
set(String name,
Object value)
|
|
void |
setBoolean(String name,
boolean value)
|
|
static void |
setDefaultProperties(String baseName)
There must be a a file " |
|
void |
setInteger(String name,
int value)
|
|
void |
setString(String name,
String value)
|
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Parameters()
| Method Detail |
|---|
public static void setDefaultProperties(String baseName)
instance().
baseName - the name of the file storing your properties (e.g. "carnot" will render
"carnot.properties")public static String getDefaultProperties()
public static Parameters instance()
public abstract Object get(String name)
public <T> T getObject(String name)
public <T> T getObject(String name,
T defaultValue)
public final String getString(String name)
name - the name of the property
null.getString(String, String)
public final String getString(String name,
String defaultValue)
name - the name of the propertydefaultValue - the default value of the property
getString(String)
public final int getInteger(String name,
int defaultValue)
name - the name of the propertydefaultValue - the default value of the property
public final long getLong(String name,
long defaultValue)
public double getDouble(String name,
double defaultValue)
name - the name of the propertydefaultValue - the default value of the property
public final boolean getBoolean(String name,
boolean defaultValue)
public final Calendar getDate(String name,
Calendar defaultValue)
yyyy-mm-dd.
public final Calendar getDate(String name)
yyyy-mm-dd.
public final List<String> getStrings(String name)
public final List<String> getStrings(String name,
String separators)
public abstract void set(String name,
Object value)
name - value -
public final void setString(String name,
String value)
public final void setInteger(String name,
int value)
public final void setBoolean(String name,
boolean value)
public abstract void flush()
public abstract void addProperties(String fileName)
fileName - the name of the file storing your properties (e.g. "carnot" will render
"carnot.properties")
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||