jSyncManager Simple Java Server

org.jSyncManager.SJS.Adapters.SMTPServer
Class Message

java.lang.Object
  extended by org.jSyncManager.SJS.Adapters.SMTPServer.Message

public class Message
extends java.lang.Object

This class provides an object representation of an e-mail message. It has several get methods which make it easy to access different properties of a typical e-mail.

Author:
Torben Werner, Marc Windle

Field Summary
protected  java.lang.StringBuffer body
          Message body
protected  Address from
          Sending address of the message
protected  java.util.Date received
          The date when this message was received
protected  java.util.Date sent
          The date when this message was sent
protected  java.util.List<Address> to
          Receiving address of the message
 
Constructor Summary
Message()
          Constructor, default empty constructor
Message(Address from, java.util.List<Address> to, java.lang.String body)
          A constructor which takes a from/to (sender/receiver), and body and initializes the sent/received dates to null.
Message(java.util.Date sent, java.util.Date received, Address from, java.util.List<Address> to, java.lang.String body)
          A constructor which takes a from/to (sender/receiver), body, and send/receive dates as arguments.
 
Method Summary
 void addTo(Address address)
          Returns the address of the receiver of a message
 void appendData(java.lang.String data)
          Appends data to the end of the message body
 java.lang.String getBody()
          Returns the body content of a message
 Address getFrom()
          Returns the address of the sender of a message
 java.util.Date getReceivedDate()
          Returns the date which this received was sent
 java.util.Date getSentDate()
          Returns the date which this message was sent
 java.util.List<Address> getTo()
          Returns the address of the receiver of a message
 java.util.Iterator<Address> getToIter()
          Returns the address of the receiver of a message
 void setFrom(Address from)
          Sets the from address of this message
 void setFrom(java.lang.String from)
          Sets the from address of this message
 void setReceived(java.util.Date received)
          Sets the received date of this message
 void setSent(java.util.Date sent)
          Sets the sent date of this message
 void setTo(java.util.List<Address> to)
          Sets the to address of this message
 java.lang.String toString()
          Returns a string representation of the message in a common format
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

from

protected Address from
Sending address of the message


to

protected java.util.List<Address> to
Receiving address of the message


received

protected java.util.Date received
The date when this message was received


sent

protected java.util.Date sent
The date when this message was sent


body

protected java.lang.StringBuffer body
Message body

Constructor Detail

Message

public Message()
Constructor, default empty constructor


Message

public Message(java.util.Date sent,
               java.util.Date received,
               Address from,
               java.util.List<Address> to,
               java.lang.String body)
A constructor which takes a from/to (sender/receiver), body, and send/receive dates as arguments.

Parameters:
sent - the date at which this message was sent
received - the date at which this message was received
from - the address of the sender
to - the address of the receiver
body - the body content of the message

Message

public Message(Address from,
               java.util.List<Address> to,
               java.lang.String body)
A constructor which takes a from/to (sender/receiver), and body and initializes the sent/received dates to null. The dates are defaulted to null.

Parameters:
from - the address of the sender
to - the address of the receiver
body - the body content of the message
Method Detail

getFrom

public Address getFrom()
Returns the address of the sender of a message

Returns:
the address of the sender of a message

setFrom

public void setFrom(java.lang.String from)
Sets the from address of this message

Parameters:
from - The address as a String

setFrom

public void setFrom(Address from)
Sets the from address of this message

Parameters:
from - The address as a String

setReceived

public void setReceived(java.util.Date received)
Sets the received date of this message

Parameters:
received - date as a Date

setSent

public void setSent(java.util.Date sent)
Sets the sent date of this message

Parameters:
sent - date as a Date

setTo

public void setTo(java.util.List<Address> to)
Sets the to address of this message

Parameters:
to - The to address as an Adddress

getTo

public java.util.List<Address> getTo()
Returns the address of the receiver of a message

Returns:
to address of the receiver of a message

getToIter

public java.util.Iterator<Address> getToIter()
Returns the address of the receiver of a message

Returns:
the address of the receiver of a message

addTo

public void addTo(Address address)
Returns the address of the receiver of a message

Parameters:
address - the address of the receiver of a message

appendData

public void appendData(java.lang.String data)
Appends data to the end of the message body

Parameters:
data - The string data to append to the message body

getBody

public java.lang.String getBody()
Returns the body content of a message

Returns:
the body content of a message

getSentDate

public java.util.Date getSentDate()
Returns the date which this message was sent

Returns:
the date which this message was sent

getReceivedDate

public java.util.Date getReceivedDate()
Returns the date which this received was sent

Returns:
the date which this received was sent

toString

public java.lang.String toString()
Returns a string representation of the message in a common format

Overrides:
toString in class java.lang.Object
Returns:
returned

jSyncManager Simple Java Server

Copyright (c) 2004 Brad BARCLAY. All Rights Reserved.