fc.web.forms
Class VEmail

java.lang.Object
  extended by fc.web.forms.FieldValidator
      extended by fc.web.forms.VEmail

public final class VEmail
extends FieldValidator

Validates a email address


Constructor Summary
VEmail(AbstractText field, String errorMessage)
          Constructs a new email validator that does not allow empty email address as valid
VEmail(AbstractText field, String errorMessage, boolean allowEmpty)
          Constructs a new email validator that allows an empty email address as valid if the allowEmpty argument is true.
 
Method Summary
 boolean validate(FormData fd, javax.servlet.http.HttpServletRequest req)
          Works with any field that returns a String via it's Field#getValue method.
 
Methods inherited from class fc.web.forms.FieldValidator
getErrorMessage, getField
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VEmail

public VEmail(AbstractText field,
              String errorMessage)
Constructs a new email validator that does not allow empty email address as valid


VEmail

public VEmail(AbstractText field,
              String errorMessage,
              boolean allowEmpty)
Constructs a new email validator that allows an empty email address as valid if the allowEmpty argument is true. This is useful for optional email fields.

Method Detail

validate

public boolean validate(FormData fd,
                        javax.servlet.http.HttpServletRequest req)
Works with any field that returns a String via it's Field#getValue method.

Specified by:
validate in class FieldValidator
Throws:
ClassCastException - If the field's Field#getValue method does not return a String