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.
Regards,
Michael Lanzetta
858-799-5307
John Keyes <[EMAIL PROTECTED]>
03/04/2003 10:28 AM
Please respond to "Jakarta Commons Developers List"
To: Jakarta Commons Developers List <[EMAIL PROTECTED]>
cc:
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
method
> >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
options:
Option a = builder.isRequired()
.withChildren(childOptions)
.create("a");
Does that explain the process?
-John K
---------------------------------------------------------------------
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]