org.jabber.jabberbeans
Class MessageBuilder

java.lang.Object
  |
  +--org.jabber.jabberbeans.PacketBuilder
        |
        +--org.jabber.jabberbeans.MessageBuilder
All Implemented Interfaces:
java.io.Serializable

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.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.jabber.jabberbeans.PacketBuilder
error, 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, getError, getErrorCode, getErrorText, getExtensionVector, getFromAddress, getIdentifier, getToAddress, getType, resetBase, setError, setErrorCode, setErrorText, setFromAddress, setIdentifier, setToAddress, setType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessageBuilder

public MessageBuilder()
Method Detail

reset

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

Specified by:
reset in class PacketBuilder

build

public Packet build()
             throws java.lang.InstantiationException
Build a new Message object based on the current builder state.

Specified by:
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'