Class EmailAddress.DomainPart

java.lang.Object
de.adrianlange.mcd.strategy.EmailAddress.DomainPart
Enclosing class:
EmailAddress

public static class EmailAddress.DomainPart extends Object

Internal representation of the domain part of an email address.

The domain part of an email john.doe+some-verp@example.com is example.com.

  • Method Details

    • toUnicode

      public String toUnicode()
      Returns the domain part as unicode string.
      Returns:
      Domain part as unicode string
    • toIdn

      public String toIdn()
      Returns the domain part as IDN string.
      Returns:
      Domain part as IDN string
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • of

      public static EmailAddress.DomainPart of(String domainPart)
      Creates a new domain part. Use ofUnicode(String) or ofIdn(String) if you know the domain format.
      Parameters:
      domainPart - String representation of the domain part, must not be null
      Returns:
      new DomainPart object created from the given string representation
    • ofUnicode

      public static EmailAddress.DomainPart ofUnicode(String unicodeDomainPart)
      Creates a new domain part from a unicode domain. IDN domain parts must use ofIdn(String).
      Parameters:
      unicodeDomainPart - String representation of the domain part, must not be null
      Returns:
      new DomainPart object created from the given string representation
    • ofIdn

      public static EmailAddress.DomainPart ofIdn(String idnDomainPart)
      Creates a new domain part from an IDN domain. Unicode domain parts must use ofUnicode(String).
      Parameters:
      idnDomainPart - String representation of the domain part, must not be null
      Returns:
      new DomainPart object created from the given string representation