Package org.jivesoftware.smack.packet
Class MessageBuilder
- java.lang.Object
-
- org.jivesoftware.smack.packet.StanzaBuilder<SB>
-
- org.jivesoftware.smack.packet.MessageOrPresenceBuilder<Message,MessageBuilder>
-
- org.jivesoftware.smack.packet.MessageBuilder
-
- All Implemented Interfaces:
MessageView
,StanzaView
,XmlLangElement
public final class MessageBuilder extends MessageOrPresenceBuilder<Message,MessageBuilder> implements MessageView
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MessageBuilder
addBody(java.lang.String language, java.lang.String body)
Adds a body with a corresponding language.protected void
addStanzaSpecificAttributes(ToStringUtil.Builder builder)
MessageBuilder
addSubject(java.lang.String language, java.lang.String subject)
Adds a subject with a corresponding language.Message
build()
MessageBuilder
getThis()
Message.Type
getType()
Returns the type of the message.MessageBuilder
ofType(Message.Type type)
MessageBuilder
setBody(java.lang.CharSequence body)
Sets the body of the message.MessageBuilder
setBody(java.lang.String body)
Sets the body of the message.MessageBuilder
setSubject(java.lang.String subject)
Sets the subject of the message.MessageBuilder
setThread(java.lang.String thread)
MessageBuilder
setThread(java.lang.String thread, java.lang.String parent)
-
Methods inherited from class org.jivesoftware.smack.packet.StanzaBuilder
addExtension, addExtensions, addOptExtensions, buildIqData, buildMessage, buildMessage, buildMessageFrom, buildMessageFrom, buildPresence, buildPresence, buildPresenceFrom, buildPresenceFrom, buildResponse, from, from, getError, getExtension, getExtensions, getExtensions, getExtensions, getFrom, getLanguage, getStanzaId, getTo, overrideExtension, removeExtension, removeExtension, setError, setLanguage, throwIfNoStanzaId, to, to, toString, willBuildStanzaWithId
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.jivesoftware.smack.packet.MessageView
getBodies, getBody, getBody, getBodyLanguages, getMessageBody, getMessageSubject, getSubject, getSubject, getSubjectLanguages, getSubjects, getThread
-
Methods inherited from interface org.jivesoftware.smack.packet.StanzaView
getError, getExtension, getExtension, getExtensions, getExtensions, getExtensions, getFrom, getStanzaId, getTo, hasExtension, hasExtension, hasExtension
-
Methods inherited from interface org.jivesoftware.smack.packet.XmlLangElement
getLanguage
-
-
-
-
Method Detail
-
addStanzaSpecificAttributes
protected void addStanzaSpecificAttributes(ToStringUtil.Builder builder)
- Specified by:
addStanzaSpecificAttributes
in classStanzaBuilder<MessageBuilder>
-
ofType
public MessageBuilder ofType(Message.Type type)
-
setThread
public MessageBuilder setThread(java.lang.String thread)
-
setThread
public MessageBuilder setThread(java.lang.String thread, java.lang.String parent)
-
setSubject
public MessageBuilder setSubject(java.lang.String subject)
Sets the subject of the message. The subject is a short description of message contents.- Parameters:
subject
- the subject of the message.- Returns:
- a reference to this builder.
-
addSubject
public MessageBuilder addSubject(java.lang.String language, java.lang.String subject)
Adds a subject with a corresponding language.- Parameters:
language
- the language of the subject being added.subject
- the subject being added to the message.- Returns:
- a reference to this builder.
- Throws:
java.lang.NullPointerException
- if the subject is null.
-
setBody
public MessageBuilder setBody(java.lang.CharSequence body)
Sets the body of the message.- Parameters:
body
- the body of the message.- Returns:
- a reference to this builder.
- See Also:
setBody(String)
-
setBody
public MessageBuilder setBody(java.lang.String body)
Sets the body of the message. The body is the main message contents.- Parameters:
body
- the body of the message.- Returns:
- a reference to this builder.
-
addBody
public MessageBuilder addBody(java.lang.String language, java.lang.String body)
Adds a body with a corresponding language.- Parameters:
language
- the language of the body being added.body
- the body being added to the message.- Returns:
- a reference to this builder.
-
getThis
public MessageBuilder getThis()
- Specified by:
getThis
in classStanzaBuilder<MessageBuilder>
-
build
public Message build()
- Specified by:
build
in classMessageOrPresenceBuilder<Message,MessageBuilder>
-
getType
public Message.Type getType()
Description copied from interface:MessageView
Returns the type of the message. If no type has been set this method will returnMessage.Type.normal
.- Specified by:
getType
in interfaceMessageView
- Returns:
- the type of the message.
-
-