JCommander 1.4
They say that a Java framework is not complete until it provides factories, and since it’s something that JCommander was still lacking, it had to be fixed.
Introducing JCommander 1.4.
Here is what’s new:
- You can now specify default values in a more flexible way than at field declaration time (documentation).
- You can use string converter factories instead of specifying converter classes on each
@Parameterannotation (documentation). - The usage is now prettier:
Usage: <main class> [options]
Options:
-debug Debug mode (default: false)
-groups Comma-separated list of group names to be run
* -log, -verbose Level of verbosity (default: 1)
-long A long number (default: 0)
- Many bug fixes and a more clever option parsing to cover odd cases.
- This release actually contains more features but I’m not telling. All the goodness available at the usual place. Operators are standing by, order now!
Comments (7)
Thanks! That was a really quick turn-around time on the new features.
Very nice, thank you. One question - can I replace in the usage, or get the message as a string to replace it myself? Cheers
Oh, stupid comment sanitizers! Let's try can I replace >main class< in the usage
Ah well, you get the drift ;-)
Hi Duncan, Yes, in the upcoming version, you can call JCommander#setProgramName() (you can get it from github if you want to try it now).
On reflection (no pun intended;-) it would be handy to get at the usage as a string. That way when my Swing app is invoked badly it can print the usage in a message box rather than to the console that isn't there. Maybe I'll have a trawl through the source... Cheers Duncan
[...] su blog pod??is leer algo m??s sobre la nueva versi??n: JCommander [...]