Class VEmail


public final class VEmail extends FieldValidator
Validates a email address
  • Constructor Summary

    Constructors
    Constructor
    Description
    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

    Modifier and Type
    Method
    Description
    boolean
    validate(FormData fd, jakarta.servlet.http.HttpServletRequest req)
    Works with any field that returns a String via it's
    invalid reference
    Field#getValue
    method.

    Methods inherited from class FieldValidator

    getErrorMessage, getField

    Methods inherited from class Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • 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 Details

    • validate

      public boolean validate(FormData fd, jakarta.servlet.http.HttpServletRequest req)
      Works with any field that returns a String via it's
      invalid reference
      Field#getValue
      method.
      Specified by:
      validate in class FieldValidator
      Throws:
      ClassCastException - If the field's
      invalid reference
      Field#getValue
      method does not return a String