commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Keyes <>
Subject Re: [VOTE] move CLI over to commons
Date Thu, 06 Jun 2002 16:33:39 GMT
> I'm looking to add two features from my MapCArgs. The first is an
> OptionType concept so that the CLI can do automatic object conversion. 
> So
> -a could have an OptionType of java.lang.Class.class or
> OptionType.CLASS_TYPE and it would automatically convert '-a
>' to the right class, or print a standard error about 
> it
> not being on the classpath.
I had a feature like this in Optz which I hadn't yet merged
with CLI.  I used concrete argument classes FileArgument,
DirectoryArgument and IntegerArgument were the ones I had
implemented.  Each class had a validateValue method that
would throw an InvalidValueException if the value was not of
the appropriate type.  I think this feature is very useful and
allows application developers to avoid writing the validation
code themselves.  This type of feature could be made pluggable
so customer Arguments could be written by users if they so

> The second feature is a pattern to build options instead of lots of 
> object
> calls.
The only thing about creating the options in this manner is that
they are *simple* options, i.e. no description, no long name, etc.
I like it though because if you are going to knock up a quick
demo this way is definitely more productive.

I had previously sent an email to James about implementing an xml
approach to creating the Options class.  When I have finished my
review of the current code I hope to get a schema knocked together
to illustrate this.  To create an Options instance then a simple
call like:
   Options options = XmlOptionReader( "cmdline.xml" );
would suffice.

Do people think that dependencies on ORO and an XML parser are
too much overhead for CLI?  Should these types of features be
made optional or shipped in a separate jar?

-John K

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message