OO Programming in Java

Singleton Example


Configuration files (.ini) are very common and useful for initializing some variables in object models.

Usage of the Configuiration object is quite simple:

Stirng hiveSize = Configuration.instance().valueOf("HIVESIZE");

int theSize = Integer(hiveSize).intValue();

Configuration.instance() returns the instance (the only one) of the Configuration class. valueOf(String) answers the string associated with "HIVESIZE".

Entries in the .ini file look like:

..
..
HIVESIZE=32
..
..

Configuration.java