Can someone please suggest a way to use/extend the current validators to
validate list of objects.
The problem is i have to write code in the following manner and don't know
if it is a good approach.

EmailAddressValidator validator = EmailAddressValidator.getInstance();
                for (final Iterator it =
invitationForm.getEmailList().iterator(); it.hasNext();)
                {
                    validator.validate(new IValidatable()
                    {

                        public void error(IValidationError error)
                        {
                            form.error("One or More of email ids are not in
valid format");
                        }

                        public Object getValue()
                        {
                            return (String)it.next();
                        }

                        public boolean isValid()
                        {
                            return form.hasError();
                        }

                    });

                    if (form.hasError())
                    {
                        break;
                    }
           }

Reply via email to