Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2010-2015 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;
 

Represents the destination of the message, consisting of To:, CC:, and BCC: fields.

By default, the string must be 7-bit ASCII. If the text must contain any other characters, then you must use MIME encoded-word syntax (RFC 2047) instead of a literal string. MIME encoded-word syntax uses the following form: =?charset?encoding?encoded-text?= . For more information, see RFC 2047 .

 
 public class Destination implements SerializableCloneable {

    
The To: field(s) of the message.
 
The CC: field(s) of the message.
 
The BCC: field(s) of the message.
 
Default constructor for a new Destination object. Callers should use the setter or fluent setter (with...) methods to initialize this object after creating it.
 
     public Destination() {}
    
    
Constructs a new Destination object. Callers should use the setter or fluent setter (with...) methods to initialize any additional object members.

Parameters:
toAddresses The To: field(s) of the message.
 
     public Destination(java.util.List<StringtoAddresses) {
         setToAddresses(toAddresses);
     }

    
The To: field(s) of the message.

Returns:
The To: field(s) of the message.
 
     public java.util.List<StringgetToAddresses() {
         if ( == null) {
                = new com.amazonaws.internal.ListWithAutoConstructFlag<String>();
               .setAutoConstruct(true);
         }
         return ;
     }
    
    
The To: field(s) of the message.

Parameters:
toAddresses The To: field(s) of the message.
 
     public void setToAddresses(java.util.Collection<StringtoAddresses) {
         if (toAddresses == null) {
             this. = null;
             return;
         }
         com.amazonaws.internal.ListWithAutoConstructFlag<StringtoAddressesCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<String>(toAddresses.size());
         toAddressesCopy.addAll(toAddresses);
         this. = toAddressesCopy;
     }
    
    
The To: field(s) of the message.

NOTE: This method appends the values to the existing list (if any). Use setToAddresses(java.util.Collection) or withToAddresses(java.util.Collection) if you want to override the existing values.

Returns a reference to this object so that method calls can be chained together.

Parameters:
toAddresses The To: field(s) of the message.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Destination withToAddresses(String... toAddresses) {
        if (getToAddresses() == nullsetToAddresses(new java.util.ArrayList<String>(toAddresses.length));
        for (String value : toAddresses) {
            getToAddresses().add(value);
        }
        return this;
    }
    
    
The To: field(s) of the message.

Returns a reference to this object so that method calls can be chained together.

Parameters:
toAddresses The To: field(s) of the message.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Destination withToAddresses(java.util.Collection<StringtoAddresses) {
        if (toAddresses == null) {
            this. = null;
        } else {
            com.amazonaws.internal.ListWithAutoConstructFlag<StringtoAddressesCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<String>(toAddresses.size());
            toAddressesCopy.addAll(toAddresses);
            this. = toAddressesCopy;
        }
        return this;
    }

    
The CC: field(s) of the message.

Returns:
The CC: field(s) of the message.
    public java.util.List<StringgetCcAddresses() {
        if ( == null) {
               = new com.amazonaws.internal.ListWithAutoConstructFlag<String>();
              .setAutoConstruct(true);
        }
        return ;
    }
    
    
The CC: field(s) of the message.

Parameters:
ccAddresses The CC: field(s) of the message.
    public void setCcAddresses(java.util.Collection<StringccAddresses) {
        if (ccAddresses == null) {
            this. = null;
            return;
        }
        ccAddressesCopy.addAll(ccAddresses);
        this. = ccAddressesCopy;
    }
    
    
The CC: field(s) of the message.

NOTE: This method appends the values to the existing list (if any). Use setCcAddresses(java.util.Collection) or withCcAddresses(java.util.Collection) if you want to override the existing values.

Returns a reference to this object so that method calls can be chained together.

Parameters:
ccAddresses The CC: field(s) of the message.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Destination withCcAddresses(String... ccAddresses) {
        if (getCcAddresses() == nullsetCcAddresses(new java.util.ArrayList<String>(ccAddresses.length));
        for (String value : ccAddresses) {
            getCcAddresses().add(value);
        }
        return this;
    }
    
    
The CC: field(s) of the message.

Returns a reference to this object so that method calls can be chained together.

Parameters:
ccAddresses The CC: field(s) of the message.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Destination withCcAddresses(java.util.Collection<StringccAddresses) {
        if (ccAddresses == null) {
            this. = null;
        } else {
            com.amazonaws.internal.ListWithAutoConstructFlag<StringccAddressesCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<String>(ccAddresses.size());
            ccAddressesCopy.addAll(ccAddresses);
            this. = ccAddressesCopy;
        }
        return this;
    }

    
The BCC: field(s) of the message.

Returns:
The BCC: field(s) of the message.
    public java.util.List<StringgetBccAddresses() {
        if ( == null) {
               = new com.amazonaws.internal.ListWithAutoConstructFlag<String>();
              .setAutoConstruct(true);
        }
        return ;
    }
    
    
The BCC: field(s) of the message.

Parameters:
bccAddresses The BCC: field(s) of the message.
    public void setBccAddresses(java.util.Collection<StringbccAddresses) {
        if (bccAddresses == null) {
            this. = null;
            return;
        }
        bccAddressesCopy.addAll(bccAddresses);
        this. = bccAddressesCopy;
    }
    
    
The BCC: field(s) of the message.

NOTE: This method appends the values to the existing list (if any). Use setBccAddresses(java.util.Collection) or withBccAddresses(java.util.Collection) if you want to override the existing values.

Returns a reference to this object so that method calls can be chained together.

Parameters:
bccAddresses The BCC: field(s) of the message.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Destination withBccAddresses(String... bccAddresses) {
        if (getBccAddresses() == nullsetBccAddresses(new java.util.ArrayList<String>(bccAddresses.length));
        for (String value : bccAddresses) {
            getBccAddresses().add(value);
        }
        return this;
    }
    
    
The BCC: field(s) of the message.

Returns a reference to this object so that method calls can be chained together.

Parameters:
bccAddresses The BCC: field(s) of the message.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Destination withBccAddresses(java.util.Collection<StringbccAddresses) {
        if (bccAddresses == null) {
            this. = null;
        } else {
            com.amazonaws.internal.ListWithAutoConstructFlag<StringbccAddressesCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<String>(bccAddresses.size());
            bccAddressesCopy.addAll(bccAddresses);
            this. = bccAddressesCopy;
        }
        return this;
    }

    
Returns a string representation of this object; useful for testing and debugging.

Returns:
A string representation of this object.
See also:
java.lang.Object.toString()
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getToAddresses() != nullsb.append("ToAddresses: " + getToAddresses() + ",");
        if (getCcAddresses() != nullsb.append("CcAddresses: " + getCcAddresses() + ",");
        if (getBccAddresses() != nullsb.append("BccAddresses: " + getBccAddresses() );
        sb.append("}");
        return sb.toString();
    }
    
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        
        hashCode = prime * hashCode + ((getToAddresses() == null) ? 0 : getToAddresses().hashCode()); 
        hashCode = prime * hashCode + ((getCcAddresses() == null) ? 0 : getCcAddresses().hashCode()); 
        hashCode = prime * hashCode + ((getBccAddresses() == null) ? 0 : getBccAddresses().hashCode()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof Destination == falsereturn false;
        Destination other = (Destination)obj;
        
        if (other.getToAddresses() == null ^ this.getToAddresses() == nullreturn false;
        if (other.getToAddresses() != null && other.getToAddresses().equals(this.getToAddresses()) == falsereturn false
        if (other.getCcAddresses() == null ^ this.getCcAddresses() == nullreturn false;
        if (other.getCcAddresses() != null && other.getCcAddresses().equals(this.getCcAddresses()) == falsereturn false
        if (other.getBccAddresses() == null ^ this.getBccAddresses() == nullreturn false;
        if (other.getBccAddresses() != null && other.getBccAddresses().equals(this.getBccAddresses()) == falsereturn false
        return true;
    }
    
    @Override
    public Destination clone() {
        try {
            return (Destinationsuper.clone();
        
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException(
                    "Got a CloneNotSupportedException from Object.clone() "
                    + "even though we're Cloneable!",
                    e);
        }
        
    }
}
    
New to GrepCode? Check out our FAQ X