commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Lanzetta" <>
Subject Re: [CLI] Version 2.0 - API
Date Tue, 04 Mar 2003 18:39:51 GMT
Still, the original poster had a point - isMandatory would typically 
return a boolean, whereas setMandatory would be used for setting the 
option.  In my code, using CLI 1.0, I've been using isRequired(true) to 
specify a required option.  The true is not necessary, but makes the point 
that I'm setting something, as opposed to getting the value.  I think 
requiring that usage might make things a bit clearer, perhaps deprecating 
the old methodology.  As for the mandatory vs. required battle, I have no 
preference - they both state what they do in clear language.

Michael Lanzetta

John Keyes <>
03/04/2003 10:28 AM
Please respond to "Jakarta Commons Developers List"

        To:     Jakarta Commons Developers List <>
        Subject:        Re: [CLI] Version 2.0 - API

> > > OptionBuilder.isMandatory() returns an OptionBuilder.  Normally "is" 

> >methods
> > > return a boolean.  The factory methods in this class (and 
> >ArgumentBuilder)
> > > should probably all start with "create" for clarity (ie. 
> >createWithChild()).
> >Yeah I know what you're saying.  What would you name the required 
> >though?
> I'm not sure what the OptionBuilder returned from 
> OptionBuilder.isMandatory() is supposed to represent/do.  Maybe 
> createRequired() would work?

The builders are to help the building of complex objects 
in a verbose manner thus eliminating the confusion that
arises due to methods with many parameters of similar type.

So if I wanted to create an option 'a' that is required:
  OptionBuilder builder = new OptionBuilder();
  Option a = builder.isRequired().create("a");

If you wanted to say that Option 'a' also has child

  Option a = builder.isRequired()
Does that explain the process?

-John K

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

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

View raw message