开发者

Saving parameters in a file

I want to use a .properties file to store some parameters with values. I also want to use these parameters as class attributes in my code. How to avoid a situation where I need to define the attributes and use their开发者_如何学C names as string keys for the .properties file. I have these names twice in my code: once as an attribute and once as a string.

Reflection would help, but there is no reflection for attribute names.


there is no reflection for attribute names

If by "attributes" you mean "fields", then this is untrue: Class.getDeclaredFields() returns those. If you mean something else, please explain what you mean.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜