com.amazonaws.services.simpleemail.model.RecipientDsnFields Maven / Gradle / Ivy
Show all versions of aws-java-sdk-osgi Show documentation
/*
 * Copyright 2010-2016 Amazon.com, Inc. or its affiliates. All Rights
 * Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License").
 * You may not use this file except in compliance with the License.
 * A copy of the License is located at
 *
 *  http://aws.amazon.com/apache2.0
 *
 * or in the "license" file accompanying this file. This file is distributed
 * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
 * express or implied. See the License for the specific language governing
 * permissions and limitations under the License.
 */
package com.amazonaws.services.simpleemail.model;
import java.io.Serializable;
/**
 * 
 * Recipient-related information to include in the Delivery Status Notification
 * (DSN) when an email that Amazon SES receives on your behalf bounces.
 * 
 * 
 * For information about receiving email through Amazon SES, see the Amazon SES Developer Guide.
 * 
 */
public class RecipientDsnFields implements Serializable, Cloneable {
    /**
     * 
     * The email address to which the message was ultimately delivered. This
     * corresponds to the Final-Recipient in the DSN. If not
     * specified, FinalRecipient will be set to the
     * Recipient specified in the BouncedRecipientInfo
     * structure. Either FinalRecipient or the recipient in
     * BouncedRecipientInfo must be a recipient of the original
     * bounced message.
     * 
     * Do not prepend the FinalRecipient email address with
     * rfc 822;, as described in RFC 3798. 
     */
    private String finalRecipient;
    /**
     * 
     * The action performed by the reporting mail transfer agent (MTA) as a
     * result of its attempt to deliver the message to the recipient address.
     * This is required by RFC
     * 3464.
     * 
     */
    private String action;
    /**
     * 
     * The MTA to which the remote MTA attempted to deliver the message,
     * formatted as specified in RFC 3464 (
     * mta-name-type; mta-name). This parameter typically applies
     * only to propagating synchronous bounces.
     * 
     */
    private String remoteMta;
    /**
     * 
     * The status code that indicates what went wrong. This is required by RFC 3464.
     * 
     */
    private String status;
    /**
     * 
     * An extended explanation of what went wrong; this is usually an SMTP
     * response. See RFC 3463
     * for the correct formatting of this parameter.
     * 
     */
    private String diagnosticCode;
    /**
     * 
     * The time the final delivery attempt was made, in RFC 822 date-time format.
     * 
     */
    private java.util.Date lastAttemptDate;
    /**
     * 
     * Additional X-headers to include in the DSN.
     * 
     */
    private com.amazonaws.internal.SdkInternalList extensionFields;
    /**
     * 
     * The email address to which the message was ultimately delivered. This
     * corresponds to the Final-Recipient in the DSN. If not
     * specified, FinalRecipient will be set to the
     * Recipient specified in the BouncedRecipientInfo
     * structure. Either FinalRecipient or the recipient in
     * BouncedRecipientInfo must be a recipient of the original
     * bounced message.
     * 
     * Do not prepend the FinalRecipient email address with
     * rfc 822;, as described in RFC 3798. 
     * 
     * @param finalRecipient
     *        The email address to which the message was ultimately delivered.
     *        This corresponds to the Final-Recipient in the DSN.
     *        If not specified, FinalRecipient will be set to the
     *        Recipient specified in the
     *        BouncedRecipientInfo structure. Either
     *        FinalRecipient or the recipient in
     *        BouncedRecipientInfo must be a recipient of the
     *        original bounced message. Do not prepend the
     *        FinalRecipient email address with
     *        rfc 822;, as described in RFC 3798.
     */
    public void setFinalRecipient(String finalRecipient) {
        this.finalRecipient = finalRecipient;
    }
    /**
     * 
     * The email address to which the message was ultimately delivered. This
     * corresponds to the Final-Recipient in the DSN. If not
     * specified, FinalRecipient will be set to the
     * Recipient specified in the BouncedRecipientInfo
     * structure. Either FinalRecipient or the recipient in
     * BouncedRecipientInfo must be a recipient of the original
     * bounced message.
     * 
     * Do not prepend the FinalRecipient email address with
     * rfc 822;, as described in RFC 3798. 
     * 
     * @return The email address to which the message was ultimately delivered.
     *         This corresponds to the Final-Recipient in the DSN.
     *         If not specified, FinalRecipient will be set to the
     *         Recipient specified in the
     *         BouncedRecipientInfo structure. Either
     *         FinalRecipient or the recipient in
     *         BouncedRecipientInfo must be a recipient of the
     *         original bounced message. Do not prepend the
     *         FinalRecipient email address with
     *         rfc 822;, as described in RFC 3798.
     */
    public String getFinalRecipient() {
        return this.finalRecipient;
    }
    /**
     * 
     * The email address to which the message was ultimately delivered. This
     * corresponds to the Final-Recipient in the DSN. If not
     * specified, FinalRecipient will be set to the
     * Recipient specified in the BouncedRecipientInfo
     * structure. Either FinalRecipient or the recipient in
     * BouncedRecipientInfo must be a recipient of the original
     * bounced message.
     * 
     * Do not prepend the FinalRecipient email address with
     * rfc 822;, as described in RFC 3798. 
     * 
     * @param finalRecipient
     *        The email address to which the message was ultimately delivered.
     *        This corresponds to the Final-Recipient in the DSN.
     *        If not specified, FinalRecipient will be set to the
     *        Recipient specified in the
     *        BouncedRecipientInfo structure. Either
     *        FinalRecipient or the recipient in
     *        BouncedRecipientInfo must be a recipient of the
     *        original bounced message. Do not prepend the
     *        FinalRecipient email address with
     *        rfc 822;, as described in RFC 3798.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public RecipientDsnFields withFinalRecipient(String finalRecipient) {
        setFinalRecipient(finalRecipient);
        return this;
    }
    /**
     * 
     * The action performed by the reporting mail transfer agent (MTA) as a
     * result of its attempt to deliver the message to the recipient address.
     * This is required by RFC
     * 3464.
     * 
     * 
     * @param action
     *        The action performed by the reporting mail transfer agent (MTA) as
     *        a result of its attempt to deliver the message to the recipient
     *        address. This is required by RFC 3464.
     * @see DsnAction
     */
    public void setAction(String action) {
        this.action = action;
    }
    /**
     * 
     * The action performed by the reporting mail transfer agent (MTA) as a
     * result of its attempt to deliver the message to the recipient address.
     * This is required by RFC
     * 3464.
     * 
     * 
     * @return The action performed by the reporting mail transfer agent (MTA)
     *         as a result of its attempt to deliver the message to the
     *         recipient address. This is required by RFC 3464.
     * @see DsnAction
     */
    public String getAction() {
        return this.action;
    }
    /**
     * 
     * The action performed by the reporting mail transfer agent (MTA) as a
     * result of its attempt to deliver the message to the recipient address.
     * This is required by RFC
     * 3464.
     * 
     * 
     * @param action
     *        The action performed by the reporting mail transfer agent (MTA) as
     *        a result of its attempt to deliver the message to the recipient
     *        address. This is required by RFC 3464.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     * @see DsnAction
     */
    public RecipientDsnFields withAction(String action) {
        setAction(action);
        return this;
    }
    /**
     * 
     * The action performed by the reporting mail transfer agent (MTA) as a
     * result of its attempt to deliver the message to the recipient address.
     * This is required by RFC
     * 3464.
     * 
     * 
     * @param action
     *        The action performed by the reporting mail transfer agent (MTA) as
     *        a result of its attempt to deliver the message to the recipient
     *        address. This is required by RFC 3464.
     * @see DsnAction
     */
    public void setAction(DsnAction action) {
        this.action = action.toString();
    }
    /**
     * 
     * The action performed by the reporting mail transfer agent (MTA) as a
     * result of its attempt to deliver the message to the recipient address.
     * This is required by RFC
     * 3464.
     * 
     * 
     * @param action
     *        The action performed by the reporting mail transfer agent (MTA) as
     *        a result of its attempt to deliver the message to the recipient
     *        address. This is required by RFC 3464.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     * @see DsnAction
     */
    public RecipientDsnFields withAction(DsnAction action) {
        setAction(action);
        return this;
    }
    /**
     * 
     * The MTA to which the remote MTA attempted to deliver the message,
     * formatted as specified in RFC 3464 (
     * mta-name-type; mta-name). This parameter typically applies
     * only to propagating synchronous bounces.
     * 
     * 
     * @param remoteMta
     *        The MTA to which the remote MTA attempted to deliver the message,
     *        formatted as specified in RFC 3464 (
     *        mta-name-type; mta-name). This parameter typically
     *        applies only to propagating synchronous bounces.
     */
    public void setRemoteMta(String remoteMta) {
        this.remoteMta = remoteMta;
    }
    /**
     * 
     * The MTA to which the remote MTA attempted to deliver the message,
     * formatted as specified in RFC 3464 (
     * mta-name-type; mta-name). This parameter typically applies
     * only to propagating synchronous bounces.
     * 
     * 
     * @return The MTA to which the remote MTA attempted to deliver the message,
     *         formatted as specified in RFC 3464 (
     *         mta-name-type; mta-name). This parameter typically
     *         applies only to propagating synchronous bounces.
     */
    public String getRemoteMta() {
        return this.remoteMta;
    }
    /**
     * 
     * The MTA to which the remote MTA attempted to deliver the message,
     * formatted as specified in RFC 3464 (
     * mta-name-type; mta-name). This parameter typically applies
     * only to propagating synchronous bounces.
     * 
     * 
     * @param remoteMta
     *        The MTA to which the remote MTA attempted to deliver the message,
     *        formatted as specified in RFC 3464 (
     *        mta-name-type; mta-name). This parameter typically
     *        applies only to propagating synchronous bounces.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public RecipientDsnFields withRemoteMta(String remoteMta) {
        setRemoteMta(remoteMta);
        return this;
    }
    /**
     * 
     * The status code that indicates what went wrong. This is required by RFC 3464.
     * 
     * 
     * @param status
     *        The status code that indicates what went wrong. This is required
     *        by RFC 3464.
     */
    public void setStatus(String status) {
        this.status = status;
    }
    /**
     * 
     * The status code that indicates what went wrong. This is required by RFC 3464.
     * 
     * 
     * @return The status code that indicates what went wrong. This is required
     *         by RFC 3464.
     */
    public String getStatus() {
        return this.status;
    }
    /**
     * 
     * The status code that indicates what went wrong. This is required by RFC 3464.
     * 
     * 
     * @param status
     *        The status code that indicates what went wrong. This is required
     *        by RFC 3464.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public RecipientDsnFields withStatus(String status) {
        setStatus(status);
        return this;
    }
    /**
     * 
     * An extended explanation of what went wrong; this is usually an SMTP
     * response. See RFC 3463
     * for the correct formatting of this parameter.
     * 
     * 
     * @param diagnosticCode
     *        An extended explanation of what went wrong; this is usually an
     *        SMTP response. See RFC 3463 for the
     *        correct formatting of this parameter.
     */
    public void setDiagnosticCode(String diagnosticCode) {
        this.diagnosticCode = diagnosticCode;
    }
    /**
     * 
     * An extended explanation of what went wrong; this is usually an SMTP
     * response. See RFC 3463
     * for the correct formatting of this parameter.
     * 
     * 
     * @return An extended explanation of what went wrong; this is usually an
     *         SMTP response. See RFC 3463 for the
     *         correct formatting of this parameter.
     */
    public String getDiagnosticCode() {
        return this.diagnosticCode;
    }
    /**
     * 
     * An extended explanation of what went wrong; this is usually an SMTP
     * response. See RFC 3463
     * for the correct formatting of this parameter.
     * 
     * 
     * @param diagnosticCode
     *        An extended explanation of what went wrong; this is usually an
     *        SMTP response. See RFC 3463 for the
     *        correct formatting of this parameter.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public RecipientDsnFields withDiagnosticCode(String diagnosticCode) {
        setDiagnosticCode(diagnosticCode);
        return this;
    }
    /**
     * 
     * The time the final delivery attempt was made, in RFC 822 date-time format.
     * 
     * 
     * @param lastAttemptDate
     *        The time the final delivery attempt was made, in RFC 822 date-time
     *        format.
     */
    public void setLastAttemptDate(java.util.Date lastAttemptDate) {
        this.lastAttemptDate = lastAttemptDate;
    }
    /**
     * 
     * The time the final delivery attempt was made, in RFC 822 date-time format.
     * 
     * 
     * @return The time the final delivery attempt was made, in RFC 822 date-time
     *         format.
     */
    public java.util.Date getLastAttemptDate() {
        return this.lastAttemptDate;
    }
    /**
     * 
     * The time the final delivery attempt was made, in RFC 822 date-time format.
     * 
     * 
     * @param lastAttemptDate
     *        The time the final delivery attempt was made, in RFC 822 date-time
     *        format.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public RecipientDsnFields withLastAttemptDate(java.util.Date lastAttemptDate) {
        setLastAttemptDate(lastAttemptDate);
        return this;
    }
    /**
     * 
     * Additional X-headers to include in the DSN.
     * 
     * 
     * @return Additional X-headers to include in the DSN.
     */
    public java.util.List getExtensionFields() {
        if (extensionFields == null) {
            extensionFields = new com.amazonaws.internal.SdkInternalList();
        }
        return extensionFields;
    }
    /**
     * 
     * Additional X-headers to include in the DSN.
     * 
     * 
     * @param extensionFields
     *        Additional X-headers to include in the DSN.
     */
    public void setExtensionFields(
            java.util.Collection extensionFields) {
        if (extensionFields == null) {
            this.extensionFields = null;
            return;
        }
        this.extensionFields = new com.amazonaws.internal.SdkInternalList(
                extensionFields);
    }
    /**
     * 
     * Additional X-headers to include in the DSN.
     * 
     * 
     * NOTE: This method appends the values to the existing list (if
     * any). Use {@link #setExtensionFields(java.util.Collection)} or
     * {@link #withExtensionFields(java.util.Collection)} if you want to
     * override the existing values.
     * 
     * 
     * @param extensionFields
     *        Additional X-headers to include in the DSN.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public RecipientDsnFields withExtensionFields(
            ExtensionField... extensionFields) {
        if (this.extensionFields == null) {
            setExtensionFields(new com.amazonaws.internal.SdkInternalList(
                    extensionFields.length));
        }
        for (ExtensionField ele : extensionFields) {
            this.extensionFields.add(ele);
        }
        return this;
    }
    /**
     * 
     * Additional X-headers to include in the DSN.
     * 
     * 
     * @param extensionFields
     *        Additional X-headers to include in the DSN.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public RecipientDsnFields withExtensionFields(
            java.util.Collection extensionFields) {
        setExtensionFields(extensionFields);
        return this;
    }
    /**
     * Returns a string representation of this object; useful for testing and
     * debugging.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getFinalRecipient() != null)
            sb.append("FinalRecipient: " + getFinalRecipient() + ",");
        if (getAction() != null)
            sb.append("Action: " + getAction() + ",");
        if (getRemoteMta() != null)
            sb.append("RemoteMta: " + getRemoteMta() + ",");
        if (getStatus() != null)
            sb.append("Status: " + getStatus() + ",");
        if (getDiagnosticCode() != null)
            sb.append("DiagnosticCode: " + getDiagnosticCode() + ",");
        if (getLastAttemptDate() != null)
            sb.append("LastAttemptDate: " + getLastAttemptDate() + ",");
        if (getExtensionFields() != null)
            sb.append("ExtensionFields: " + getExtensionFields());
        sb.append("}");
        return sb.toString();
    }
    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (obj instanceof RecipientDsnFields == false)
            return false;
        RecipientDsnFields other = (RecipientDsnFields) obj;
        if (other.getFinalRecipient() == null
                ^ this.getFinalRecipient() == null)
            return false;
        if (other.getFinalRecipient() != null
                && other.getFinalRecipient().equals(this.getFinalRecipient()) == false)
            return false;
        if (other.getAction() == null ^ this.getAction() == null)
            return false;
        if (other.getAction() != null
                && other.getAction().equals(this.getAction()) == false)
            return false;
        if (other.getRemoteMta() == null ^ this.getRemoteMta() == null)
            return false;
        if (other.getRemoteMta() != null
                && other.getRemoteMta().equals(this.getRemoteMta()) == false)
            return false;
        if (other.getStatus() == null ^ this.getStatus() == null)
            return false;
        if (other.getStatus() != null
                && other.getStatus().equals(this.getStatus()) == false)
            return false;
        if (other.getDiagnosticCode() == null
                ^ this.getDiagnosticCode() == null)
            return false;
        if (other.getDiagnosticCode() != null
                && other.getDiagnosticCode().equals(this.getDiagnosticCode()) == false)
            return false;
        if (other.getLastAttemptDate() == null
                ^ this.getLastAttemptDate() == null)
            return false;
        if (other.getLastAttemptDate() != null
                && other.getLastAttemptDate().equals(this.getLastAttemptDate()) == false)
            return false;
        if (other.getExtensionFields() == null
                ^ this.getExtensionFields() == null)
            return false;
        if (other.getExtensionFields() != null
                && other.getExtensionFields().equals(this.getExtensionFields()) == false)
            return false;
        return true;
    }
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        hashCode = prime
                * hashCode
                + ((getFinalRecipient() == null) ? 0 : getFinalRecipient()
                        .hashCode());
        hashCode = prime * hashCode
                + ((getAction() == null) ? 0 : getAction().hashCode());
        hashCode = prime * hashCode
                + ((getRemoteMta() == null) ? 0 : getRemoteMta().hashCode());
        hashCode = prime * hashCode
                + ((getStatus() == null) ? 0 : getStatus().hashCode());
        hashCode = prime
                * hashCode
                + ((getDiagnosticCode() == null) ? 0 : getDiagnosticCode()
                        .hashCode());
        hashCode = prime
                * hashCode
                + ((getLastAttemptDate() == null) ? 0 : getLastAttemptDate()
                        .hashCode());
        hashCode = prime
                * hashCode
                + ((getExtensionFields() == null) ? 0 : getExtensionFields()
                        .hashCode());
        return hashCode;
    }
    @Override
    public RecipientDsnFields clone() {
        try {
            return (RecipientDsnFields) super.clone();
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException(
                    "Got a CloneNotSupportedException from Object.clone() "
                            + "even though we're Cloneable!", e);
        }
    }
}