|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.artoflife.util.Configuration
Allows access to typed configuration properties. Properties are defined:
loadConfiguration(java.lang.String)
A custom resource name can be specified with
loadConfiguration(java.lang.String)
although the default "configuration.properties" resource
is always loaded from the classpath if it can be found.
This could be replaced with the config stuff in Jakarta Avalon if it gets unwieldy in real life.
Method Summary | |
char |
getChar(java.lang.String key,
char defaultValue)
|
java.lang.Class |
getClass(java.lang.String key,
java.lang.Class defaultValue)
|
java.util.List |
getClasses(java.lang.String keyPrefix)
Of form some.prefix.0=foo , some.prefix.1=bar . |
java.util.List |
getDoubles(java.lang.String keyPrefix)
Of form some.prefix.0=foo , some.prefix.1=bar . |
float |
getFloat(java.lang.String key,
float defaultValue)
|
static Configuration |
getInstance()
Singleton. |
java.util.SortedMap |
getInstancesProbabilities(java.lang.String propertyPrefix)
Create a sorted map of probability (Float) against an instance of some class: 0.1 an instance with 10% probability 0.2 a different instance with 10% probability 1.0 an instance with 80% probability The implementation ensures that the final entry always has a probability of exactly 1.0. |
int |
getInt(java.lang.String key,
int defaultValue)
|
java.lang.String |
getString(java.lang.String key,
java.lang.String defaultValue)
|
java.util.List |
getStrings(java.lang.String keyPrefix)
Of form some.prefix.0=foo , some.prefix.1=bar . |
void |
loadConfiguration(java.lang.String resourceName)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static Configuration getInstance()
public void loadConfiguration(java.lang.String resourceName) throws java.io.IOException
java.io.IOException
public java.lang.String getString(java.lang.String key, java.lang.String defaultValue)
public char getChar(java.lang.String key, char defaultValue)
public java.lang.Class getClass(java.lang.String key, java.lang.Class defaultValue)
public int getInt(java.lang.String key, int defaultValue)
public float getFloat(java.lang.String key, float defaultValue)
public java.util.List getStrings(java.lang.String keyPrefix)
some.prefix.0=foo
, some.prefix.1=bar
.
public java.util.List getClasses(java.lang.String keyPrefix)
some.prefix.0=foo
, some.prefix.1=bar
.
public java.util.List getDoubles(java.lang.String keyPrefix)
some.prefix.0=foo
, some.prefix.1=bar
.
public java.util.SortedMap getInstancesProbabilities(java.lang.String propertyPrefix)
Load from configuration properties:
[prefix].class.0
and optionally
[prefix].probability.0
|
artoflife pre0.1.0-dev | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |