I solve this in my configuration classes via overloaded methods.
conf.getValue(); Object
conf.getString(); String
conf.getInteger(); Integer
etc.
On Mon, 11 Aug 2003, Gary Gregory wrote:
> - XML configuration?
>
> It just dawned on me that starting from an XML file would not only allow for
> a tool to generate cli2 "builder" code, but that additional type-safe
> wrapper methods could be generated such that instead of an app doing:
>
> String name = cmd.getValue("n");
> int count = Integer.parseInt(cmd.getValue("c"));
>
> You could have:
>
> String countryCode = myCmd.getName();
> int count = myCmd.getCount();
>
> Which is stuff I end up doing in my apps now.
>
> Gary
>
> -----Original Message-----
> From: Rob Oxspring [mailto:[EMAIL PROTECTED]
> Sent: Monday, August 11, 2003 17:10
> To: Jakarta Commons Developers List
> Subject: [CLI] 2.0 Proposal
>
> Hi all,
>
> I've finally got to another sensible point to present my CLI2 proposal.
> I've started using the maven build process so this time I'm able to supply
> binaries as well as sources, unfortunately though, I've not bothered to get
> them named sensibly yet.
>
> Grab zips from http://www.oxspring.demon.co.uk/cli/3/ and have a quick look
> at http://www.oxspring.demon.co.uk/cli/3/docs/usage.html for a first cut of
> basic usage documentation.
>
> So, features:
>
> - Complete rewrite to use clean model from the beginning.
> - Sits in org.apache.commons.cli2 so that there is no conflict with the
> cli1 class files - they can probably be deprecated rather than deleted.
> - Each Option implementation is responsible for its own functionality -
> parsing, validation, help/usage strings all handled by the Options
> themselves.
> - Copes with standard options, cvs style commands and +/- switches with
> arguments and in flexible groups.
> - Copes with java style property arguments and "--" options in a clean
> mannar
> - Anonymous arguments "fall out" of the design (just add to a Group)
> - Easily extended to new option types with minimal changes necessary
> - HelpFormatter has returned
> - CommandLineParser adds parseAndHelp(..) method to easily add basic
> error reporting and usage help to client applications (Only thought of this
> at the weekend but it seems to work and only throws the IOException of
> writing out the help
> http://www.oxspring.demon.co.uk/cli/3/docs/usage.html#Querying%20CommandLine
> )
> - Order of Options is dependant on Comparators so can be customised at
> runtime.
>
>
> And still todo:
> - More docs
> - Pluggable argument validation
> - XML configuration?
> - Reflection configuration?
> - Ant task generation?
> - Always more tests
>
>
> Any thoughts and comments are welcome,
>
> Rob
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]