java.lang.Object
de.powerstat.validation.values.EMail
All Implemented Interfaces:
IValueObject, Comparable<EMail>

public final class EMail extends Object implements Comparable<EMail>, IValueObject
Electronic mail. Probably DSGVO relevant. TODO Hostname exists? TODO email exists check
  • Field Details

    • LOCAL_REGEXP

      private static final Pattern LOCAL_REGEXP
      Local part regexp.
    • email

      private final String email
      EMail.
    • domainPart

      private final Hostname domainPart
      EMails domain part.
    • localPart

      private final String localPart
      EMails local part.
  • Constructor Details

    • EMail

      private EMail(String email)
      Constructor. Comments, double quotes and UTF-8 characters within the emails local part are not yet supported.
      Parameters:
      email - EMail
      Throws:
      NullPointerException - if email is null
      IllegalArgumentException - if email is not an supported email address
  • Method Details

    • of

      public static EMail of(String email)
      EMail factory.
      Parameters:
      email - EMail
      Returns:
      EMail object
    • stringValue

      public String stringValue()
      Returns the value of this EMail as a string.
      Specified by:
      stringValue in interface IValueObject
      Returns:
      The text value represented by this object after conversion to type string.
    • getDomainPart

      public String getDomainPart()
      Get emails domain part string.
      Returns:
      Domain part string
    • getReverseDomainPart

      public String getReverseDomainPart()
      Get emails reverse domain part string.
      Returns:
      Reverse domain part string
    • getLocalPart

      public String getLocalPart()
      Get emails local part string.
      Returns:
      Local part string
    • hashCode

      public int hashCode()
      Calculate hash code.
      Overrides:
      hashCode in class Object
      Returns:
      Hash
      See Also:
    • equals

      public boolean equals(Object obj)
      Is equal with another object.
      Overrides:
      equals in class Object
      Parameters:
      obj - Object
      Returns:
      true when equal, false otherwise
      See Also:
    • toString

      public String toString()
      Returns the string representation of this EMail. The exact details of this representation are unspecified and subject to change, but the following may be regarded as typical: "EMail[email=user@example.com]"
      Overrides:
      toString in class Object
      Returns:
      String representation of this EMail
      See Also:
    • compareTo

      public int compareTo(EMail obj)
      Compare with another object.
      Specified by:
      compareTo in interface Comparable<EMail>
      Parameters:
      obj - Object to compare with
      Returns:
      0: equal; 1: greater; -1: smaller
      See Also: