Class Email.Builder

  • Enclosing class:
    Email

    public static final class Email.Builder
    extends Object
    Builder creates instances of Email from values set by the builder's methods.
    • Constructor Detail

      • Builder

        public Builder()
        The constructor for the builder. By default, validation will be enabled.
      • Builder

        public Builder​(boolean enableValidation)
        The constructor for the builder.
        Parameters:
        enableValidation - Whether validation should be enabled.
    • Method Detail

      • address

        public Email.Builder address​(String address)
        Set the email address and domain fields for the request. If you set the email address from this method, you do not need to set the domain separately. The domain will be set to the domain of the email address and the address field will be set to the email address passed. The email address will be sent in plain text unless you also call hashAddress() to instead send it as an MD5 hash.
        Parameters:
        address - The valid email address used in the transaction.
        Returns:
        The builder object.
        Throws:
        IllegalArgumentException - when address is not a valid email address.
      • hashAddress

        public Email.Builder hashAddress()
        Send the email address as its MD5 hash. By default the email address set by address(String) will be sent in plain text. Enable sending it as an MD5 hash instead by calling this method.
        Returns:
        The builder object.
      • domain

        public Email.Builder domain​(String domain)
        Parameters:
        domain - The domain of the email address. This only needs to be set if the email address is not set.
        Returns:
        The builder object.
        Throws:
        IllegalArgumentException - when domain is not a valid domain.
      • build

        public Email build()
        Returns:
        An instance of Email created from the fields set on this builder.