用于Java的类型安全配置读/写库? [英] Type-safe configuration read/write library for Java?
问题描述
有没有一个好的配置库Java,这将允许我以类型安全的方式读设置?例如通过我的制作的IConfiguration接口的getter和setter声明并允许我通过它读/写配置。
Is there a good configuration library for Java which will allow me to read settings in a type-safe way? For example by taking my crafted IConfiguration interface with getters and setters declared and allowing me to read/write configuration via it.
使用<$ cc读取设置有点无聊$ c> properties.getProperty(group.setting),然后将其强制转换为所需类型。 Apache commons配置允许使用 config.getDouble(number)
,但是number这里是一个字符串,我想要能够做 double value = config.GetNumber()
。
It's a bit boring to read settings using properties.getProperty("group.setting")
and then cast it to needed type. Apache commons configuration allows to use something like config.getDouble("number")
, but "number" here is a string again and I would like to be able to do something like double value = config.GetNumber()
.
推荐答案
OWNER 图书馆做你想要的。
这篇关于用于Java的类型安全配置读/写库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!