admin管理员组文章数量:1025478
The Apache Commons Configuration Java library can easily read repeated properties as lists and/or arrays.
How can I read indexed properties?
Repeated properties
Sample code from the Commons Configuration user guide.
usergui.properties file:
colors.pie = #FF0000
colors.pie = #00FF00
colors.pie = #0000FF
Java code:
Configurations configs = new Configurations();
PropertiesConfiguration config = configs.properties("usergui.properties");
List<String> list = config.getList(String.class, "colors.pie"));
String[] array = config.getStringArray("colors.pie")));
The list
and array
variables will both contain [#FF0000, #00FF00, #0000FF]
.
Indexed properties
usergui.properties file:
colors.pie.0 = #FF0000
colors.pie.1 = #00FF00
colors.pie.2 = #0000FF
Is there a way I can use Commons Configuration to read these properties as a list and/or an array?
The Apache Commons Configuration Java library can easily read repeated properties as lists and/or arrays.
How can I read indexed properties?
Repeated properties
Sample code from the Commons Configuration user guide.
usergui.properties file:
colors.pie = #FF0000
colors.pie = #00FF00
colors.pie = #0000FF
Java code:
Configurations configs = new Configurations();
PropertiesConfiguration config = configs.properties("usergui.properties");
List<String> list = config.getList(String.class, "colors.pie"));
String[] array = config.getStringArray("colors.pie")));
The list
and array
variables will both contain [#FF0000, #00FF00, #0000FF]
.
Indexed properties
usergui.properties file:
colors.pie.0 = #FF0000
colors.pie.1 = #00FF00
colors.pie.2 = #0000FF
Is there a way I can use Commons Configuration to read these properties as a list and/or an array?
本文标签: javaHow to read indexed properties with Apache Commons ConfigurationStack Overflow
版权声明:本文标题:java - How to read indexed properties with Apache Commons Configuration - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745635411a2160417.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论