args4j comes with a built-in support for parsing options into several Java datatypes, such as int, String, and Enum. This support can be extended by writing OptionHandler implementation in an application and registering it to the CmdLineParser class.

In fact most of the built-in suppor is implemented as using this mechanism. See the source code for some of the OptionHandler class for details of how to do this.