001package org.codemonkey.simplejavamail; 002 003import javax.mail.Message.RecipientType; 004 005/** 006 * An immutable recipient object, with a name, emailadres and recipient type (eg {@link RecipientType#BCC}). 007 * 008 * @author Benny Bottema 009 */ 010public final class Recipient { 011 012 private final String name; 013 014 private final String address; 015 016 private final RecipientType type; 017 018 /** 019 * Constructor; initializes this recipient object. 020 * 021 * @param name The name of the recipient. 022 * @param address The email address of the recipient. 023 * @param type The recipient type (eg. {@link RecipientType#TO}). 024 * @see RecipientType 025 */ 026 public Recipient(final String name, final String address, final RecipientType type) { 027 this.name = name; 028 this.address = address; 029 this.type = type; 030 } 031 032 /** 033 * Bean getter for {@link #name}; 034 */ 035 public String getName() { 036 return name; 037 } 038 039 /** 040 * Bean getter for {@link #address}; 041 */ 042 public String getAddress() { 043 return address; 044 } 045 046 /** 047 * Bean getter for {@link #type}; 048 */ 049 public RecipientType getType() { 050 return type; 051 } 052}