KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > openedit > modules > email > Recipient


1 /*
2  * Created on Sep 26, 2003
3  *
4 /*
5 Copyright (c) 2003 eInnovation Inc. All rights reserved
6
7 This library is free software; you can redistribute it and/or modify it under the terms
8 of the GNU Lesser General Public License as published by the Free Software Foundation;
9 either version 2.1 of the License, or (at your option) any later version.
10
11 This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
12 without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 See the GNU Lesser General Public License for more details.
14 */

15 package com.openedit.modules.email;
16
17 /**
18  * @author Matt Avery, mavery@einnovation.com
19  */

20 public class Recipient
21 {
22     protected String JavaDoc fieldEmailAddress;
23     protected String JavaDoc fieldFirstName;
24     protected String JavaDoc fieldLastName;
25     public String JavaDoc getEmailAddress()
26     {
27         return fieldEmailAddress;
28     }
29
30     public String JavaDoc getFirstName()
31     {
32         return fieldFirstName;
33     }
34
35     public String JavaDoc getLastName()
36     {
37         return fieldLastName;
38     }
39
40     public void setEmailAddress(String JavaDoc string)
41     {
42         fieldEmailAddress = string;
43     }
44
45     public void setFirstName(String JavaDoc string)
46     {
47         fieldFirstName = string;
48     }
49
50     public void setLastName(String JavaDoc string)
51     {
52         fieldLastName = string;
53     }
54
55     public String JavaDoc getFullName()
56     {
57         StringBuffer JavaDoc name = new StringBuffer JavaDoc();
58         if ( getFirstName() != null)
59         {
60             name.append(getFirstName());
61         }
62         if ( getLastName() != null)
63         {
64             if( name.length() > 0)
65             {
66                 name.append(" ");
67             }
68             name.append(getLastName());
69         }
70         if ( name.indexOf(",") > -1 || name.indexOf(".") > -1 )
71         {
72             name.insert(0,"\"");
73             name.append("\"");
74         }
75         return name.toString();
76     }
77     public String JavaDoc toString()
78     {
79         return getFullName() + " <" + getEmailAddress() + ">";
80     }
81 }
82
Popular Tags