| Name | Modified | Size | Downloads / Week |
|---|---|---|---|
| README.TXT | 2012-10-27 | 930 Bytes | |
| smart-properties.jar | 2012-10-27 | 69.0 kB | |
| Totals: 2 Items | 69.9 kB | 0 |
This is a configuration reader utility.
Store your configuration in a file and then read them using ConfigReader class.
Helps you write rich property expressions involving arithmetic and logical operators.
A sample configuration looks like this ...
# ------------------------------------------------------------------------------
# Number of milliseconds in a minute
MIN2MIL = 1000 * 60
# Extract value from System Properties
env = $$('env')
jdbc.timeout = MIN2MIL * IF(env == 'DEV' ? 50 : IF(env == 'QA' ? 30 : 10 ) )
jdbc.user = IF(env == "DEV" ? 'user.dev' : IF(env == 'QA' ? 'user.qa' : 'user.prd'))
# ------------------------------------------------------------------------------
Now read it as follows ...
InputStream inp = getClass().getResourceAsStream("/ejaz/utils/smartprops/admin/a.cfg");
ConfigReader pr = new ConfigReader(inp);
System.out.println(pr.toProperties());