args4j comes with a built-in support for parsing options into several Java datatypes (such as int, String, and Enum). You can extend this further by writing your own OptionHandler implementation, then registering it to the CmdLineParser class.

In fact, most of the built-in support is implemented using this mechanism. The OptionHandler class's source code details how to do this.