Features
1. Configuration arrays with auto typization -
(DONE)
The idea is automatic configuration of properties defined as arrays of primitive java types (e.g. String[], long[], boolean[]).
The configuration syntax should be native (if supported) for the particular configuration file format or comma separated values string (CSVS).
Configuration syntax proposition
JSON
Native:
arrayProperty:[val1,val2,val3]
CSVS:
arrayProperty:"val1,val2,val3"
NOTE: CSVS is partly supported for String arrays
XML
Native:
<arrayProperty> <value>val1</value> <value>val2</value> <value>val3</value> </arrayProperty>
CSVS:
<arrayProperty>val1,val2,val3</arrayProperty>
Properties File
Native:
Not supported
CSVS:
arrayProperty=val1,val2,val3
Examples
Configurable object - DistributionConfig.java
@ConfigreMe(name="distribution.json") DistributionConfig{ .... /** * Defines distributed parts */ @Configure private String[] parts; /** * Defines distribution as calls ratio to each instance */ @Configure private int[] ratio; .... }
JSON configuration - distribution.json
{ ratio:["part1","part2","part3","part4"], ratio:[1,7,3,5] }