org.jabber.jabberbeans
Class MessageBuilder

java.lang.Object
  |
  +--org.jabber.jabberbeans.PacketBuilder
        |
        +--org.jabber.jabberbeans.MessageBuilder

public class MessageBuilder
extends PacketBuilder
implements java.io.Serializable

This class is used to build the complex 'Message' object. After entering all the appropriate commands, you call build(), which returns a message object. Unlike most Builder Patterns, this is not used to create different types of objects. However, Message objects are meant to be immutable, and the complex creation (variable number and types of arguments) made this class much simpler.

Version:
$Revision: 1.1.1.1 $
Author:
David Waite <dwaite@jabber.comgt;, $Author: lucky $
See Also:
Serialized Form

Field Summary
private  java.lang.String body
          body of message.
private  java.lang.String subject
          subject line of message
private  java.lang.String thread
          thread identifier.
 
Fields inherited from class org.jabber.jabberbeans.PacketBuilder
errorCode, errorText, extensions, fromAddress, identifier, toAddress, type
 
Constructor Summary
MessageBuilder()
           
 
Method Summary
 Packet build()
          Build a new Message object based on the current builder state.
 java.lang.String getBody()
          get the message body
 java.lang.String getSubject()
          get the subject of the message
 java.lang.String getThread()
          get the current discussion thread this message is being created with.
 void reset()
          Reset prepares the message builder class to build a new message.
 void setBody(java.lang.String body)
          set the message body (the meat of the message)
 void setSubject(java.lang.String subject)
          set the subject of the message
 void setThread(java.lang.String thread)
          set the discussion thread that the message belongs to.
 
Methods inherited from class org.jabber.jabberbeans.PacketBuilder
addExtension, delExtension, getErrorCode, getErrorText, getExtensionVector, getFromAddress, getIdentifier, getToAddress, getType, resetBase, setErrorCode, setErrorText, setFromAddress, setIdentifier, setToAddress, setType
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

thread

private java.lang.String thread
thread identifier. indicates the message is still in the same 'thread', i.e that it is the same discussion. The client returns the thread unchanged if it is a reply to a message.

subject

private java.lang.String subject
subject line of message

body

private java.lang.String body
body of message.
Constructor Detail

MessageBuilder

public MessageBuilder()
Method Detail

reset

public void reset()
Reset prepares the message builder class to build a new message.
Overrides:
reset in class PacketBuilder

build

public Packet build()
             throws java.lang.InstantiationException
Build a new Message object based on the current builder state.
Overrides:
build in class PacketBuilder
Returns:
Message created with the properties
Throws:
java.lang.InstantiationException - thrown if a valid message cannot be constructed from the current parameters.

setThread

public void setThread(java.lang.String thread)
set the discussion thread that the message belongs to.
Parameters:
thread - a value of type 'String'

getThread

public java.lang.String getThread()
get the current discussion thread this message is being created with.
Returns:
a value of type 'String'

setSubject

public void setSubject(java.lang.String subject)
set the subject of the message
Parameters:
subject - a value of type 'String'

getSubject

public java.lang.String getSubject()
get the subject of the message
Returns:
a value of type 'String'

setBody

public void setBody(java.lang.String body)
set the message body (the meat of the message)
Parameters:
body - a value of type 'String'

getBody

public java.lang.String getBody()
get the message body
Returns:
a value of type 'String'