> If the validate() method does the type checking then we must implement
> type
> conversion code and type checking code in every single form bean we
> write!
> On large systems, this is sometimes very unfun.
>
> Any thoughts?
You could use a Visitor pattern for an application Validator. Each form
would implement a Visitable interface and could be passed to the application
Validator where it (the Validator) would then determine which validation to
use for the form, perform the validation, and return successfully or through
some exception. This way, all validation logic can reside in one location.
The kind of bends some OO concepts (encapsulation), but is a nice way to
decouple the validation logic from each form.

HTH

Robert

Reply via email to