用于Java的类型安全配置读/写库? [英] Type-safe configuration read/write library for Java?

查看:86
本文介绍了用于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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆