KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > scalagent > joram > mom > dest > mail > SenderInfo


1 /*
2  * JORAM: Java(TM) Open Reliable Asynchronous Messaging
3  * Copyright (C) 2003 - 2007 ScalAgent Distributed Technologies
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
18  * USA.
19  *
20  * Initial developer(s): Nicolas Tachker (ScalAgent)
21  * Contributor(s):
22  */

23 package com.scalagent.joram.mom.dest.mail;
24
25 public class SenderInfo implements java.io.Serializable JavaDoc {
26   public String JavaDoc smtpServer;
27   public String JavaDoc to;
28   public String JavaDoc cc;
29   public String JavaDoc bcc;
30   public String JavaDoc from;
31   public String JavaDoc subject;
32   public String JavaDoc selector;
33   
34   public SenderInfo(String JavaDoc smtpServer,
35                     String JavaDoc to,
36                     String JavaDoc cc,
37                     String JavaDoc bcc,
38                     String JavaDoc from,
39                     String JavaDoc subject,
40                     String JavaDoc selector) {
41     this.smtpServer = smtpServer;
42     this.to = to;
43     this.cc = cc;
44     this.bcc = bcc;
45     this.from = from;
46     this.subject = subject;
47     this.selector = selector;
48   }
49   
50   public String JavaDoc toString() {
51     StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
52     sb.append("(smtp=");
53     sb.append(smtpServer);
54     sb.append(",to=");
55     sb.append(to);
56     sb.append(",cc=");
57     sb.append(cc);
58     sb.append(",bcc=");
59     sb.append(bcc);
60     sb.append(",from=");
61     sb.append(from);
62     sb.append(",subject=");
63     sb.append(subject);
64     sb.append(",selector=");
65     sb.append(selector);
66     sb.append(")");
67     return sb.toString();
68   }
69
70   public boolean equals(Object JavaDoc obj) {
71     if (! (obj instanceof SenderInfo))
72       return false;
73     else {
74       SenderInfo si = (SenderInfo) obj;
75       boolean b = true;
76       if ((smtpServer != null) && (si.smtpServer != null))
77         b &= smtpServer.equals(si.smtpServer);
78       if ((to != null) && (si.to != null))
79         b &= to.equals(si.to);
80       if ((cc != null) && (si.cc != null))
81         b &= cc.equals(si.cc);
82       if ((bcc != null) && (si.bcc != null))
83         b &= bcc.equals(si.bcc);
84       if ((from != null) && (si.from != null))
85         b &= from.equals(si.from);
86       if ((subject != null) && (si.subject != null))
87         b &= subject.equals(si.subject);
88       if ((selector != null) && (si.selector != null))
89         b &= selector.equals(si.selector);
90       return b;
91     }
92   }
93 }
94
Popular Tags