On Wed, 28 Jan 2004, David Graham wrote:

> What about setting a property in a Validator instance similar to the
> returnAllErrors handling instead of creating a new version of the method?

I assume you're referring to 'onlyReturnErrors'? Yes, that's a fine idea.
I'll do that instead. Do you have a preference for the sense? For example,
'validateAllFields' versus 'returnOnFirstError' (or something)? (The
former seems easier to find a short name for. ;)

--
Martin Cooper


>
> David
>
> --- Martin Cooper <[EMAIL PROTECTED]> wrote:
> > In certain circumstances, it would be convenient to be able to short
> > circuit the validation process, and bail out as soon as an error occurs,
> > rather than to continue to validate the remaining fields.
> >
> > One example of this is where Validator is being used to validate method
> > arguments, where the method throws an exception on an invalid argument,
> > and where that exception can report only a single error.
> >
> > I'd like to add a second validate() method to Validator that takes a
> > parameter indicating whether or not to bail out on first error, and to
> > refactor the existing method to use the new one.
> >
> > Something like this:
> >
> >     // This method exists today
> >     public ValidatorResults validate()
> >             throws ValidatorException {
> >         // Delegate to the new implementation
> >         return validate(true);
> >     }
> >
> >     // New method with parameter
> >     public ValidatorResults validate(boolean validateAll)
> >             throws ValidatorException {
> >         // Do what validate() does today, but break out of the
> >         // loop when the first error occurs, unless validateAll
> >         // is true.
> >     }
> >
> > Although I'm a Validator committer, I'm not exactly a regular
> > contributor
> > to the code base, so I'd like to hear from those more involved than I am
> > before committing the changes. If nobody objects, I'll go ahead and make
> > the changes in the next day or so.
> >
> > --
> > Martin Cooper
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free web site building tool. Try it!
> http://webhosting.yahoo.com/ps/sb/
>
> ---------------------------------------------------------------------
> 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]

Reply via email to