Is there a well-established approach for documenting Java ‘properties’ file contents, including:
- specifying the data type/contents expected for a given key
- specifying whether a key is required for the application to function
- providing a description of the key’s meaning
Currently, I maintain (by hand) a .properties file that is the default, and I write a prose description of the data type and description of each key in a comment before. This does not lead to a programmatically accessible properties file.
I guess what I’m looking for is a ‘getopt’ equivalent for properties files…
[EDIT: Related]
I have never seen a standard way of doing it. What I would probably do is:
It doesn’t get you anything over what you are doing by hand, except that you can manage the information in a different way that might be easier to deal with – for example you could have a program that spit out the comments to read in. It would potentially give you the programmatic access that you need, but it is a roll-your-own sort of thing.
Or it might just be too much work for too little to gain (which is why there isn’t something obvious out there).
If you can specify the sort of comments you want to see I could take a stab at writing something if I get bored 🙂 (it is the sort of thing I like to do for fun, sick I know :-).
Ok… I got bored… here is something that is at least a start 🙂
And a simple test for it: