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 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.
If by “attributes” you mean “fields”, then this is untrue:
Class.getDeclaredFields()returns those. If you mean something else, please explain what you mean.