The juneau-config library contains a powerful API for creating and using INI-style config files.
| # A set of entries
| [Section1]
|
| # An integer
| key1 = 1
|
| # A boolean
| key2 = true
|
| # An array
| key3 = 1,2,3
|
| # A POJO
| key4 = http://bar
Config files are accessed through the {@link oaj.config.Config} class which
are created through the {@link oaj.config.Config.Builder} class.
Builder creator methods are provided on the Config class:
| // Create a Config object
| Config config = Config.create().name("MyConfig.cfg").build();
|
| // Read values from section #1
| int key1 = config.getInt("Section1/key1");
| boolean key2 = config.getBoolean("Section1/key2");
| int[] key3 = config.getObject("Section1/key3", int[].class);
| URL key4 = config.getObject("Section1/key4", URL.class);
The config language may look simple but it is a very powerful feature with many capabilities.