public Map<ConfigurationProperty, List<String>> parseProperties(Map<ConfigurationProperty, List<String>> propertyMap, String... args) throws InterpreterPropertyException { for ( ConfigurationProperty p : getProperties()) { if ( p.hasDefaults()) { List<String> properties = getOrCreatePropertyList(propertyMap, p); Collections.addAll(properties, p.getDefaults()); } } return propertyMap; } }
/** * Create a configuration using process arguments, System Properties and defaults */ public ConfigReader(List<ConfigurationProperty> properties, String[] args) { this.properties = properties; this.args = args; //where a property is in PropertySourceMode.OVERRIDE the ordering of sources here is important //sys props are last since it is useful to be able to use a sys prop to override command line //parameters for test suites which run as part of a component build which is checked in to source control - //otherwise it is necessary to commit changes to files to achieve something simple like increasing logging //to debug level. Continuous integration tools such as team city let you set a sys prop easily to do this. propertySources = new ConfigSource[] { new DefaultsConfigSource(properties), new CommandLineParser(properties), new SystemPropertyParser(properties) }; }