Package org.jivesoftware.smack.packet
Class Message
- java.lang.Object
-
- org.jivesoftware.smack.packet.Stanza
-
- org.jivesoftware.smack.packet.MessageOrPresence<MessageBuilder>
-
- org.jivesoftware.smack.packet.Message
-
- All Implemented Interfaces:
Element
,MessageView
,NamedElement
,StanzaView
,TopLevelStreamElement
,XmlElement
,XmlLangElement
public final class Message extends MessageOrPresence<MessageBuilder> implements MessageView
Represents XMPP message packets. A message can be one of several types:- Message.Type.NORMAL -- (Default) a normal text message used in email like interface.
- Message.Type.CHAT -- a typically short text message used in line-by-line chat interfaces.
- Message.Type.GROUP_CHAT -- a chat message sent to a groupchat server for group chats.
- Message.Type.HEADLINE -- a text message to be displayed in scrolling marquee displays.
- Message.Type.ERROR -- indicates a messaging error.
Message Types Message type Field Normal Chat Group Chat Headline XMPPError subject SHOULD SHOULD NOT SHOULD NOT SHOULD NOT SHOULD NOT thread OPTIONAL SHOULD OPTIONAL OPTIONAL SHOULD NOT body SHOULD SHOULD SHOULD SHOULD SHOULD NOT error MUST NOT MUST NOT MUST NOT MUST NOT MUST
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Message.Body
Represents a message body, its language and the content of the message.static class
Message.Subject
Represents a message subject, its language and the content of the subject.static class
Message.Thread
static class
Message.Type
Represents the type of a message.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MessageBuilder
asBuilder()
MessageBuilder
asBuilder(String id)
MessageBuilder
asBuilder(XMPPConnection connection)
String
getElementName()
Returns the root element name.Message.Type
getType()
Returns the type of the message.String
toString()
Returns a short String describing the Stanza.XmlStringBuilder
toXML(XmlEnvironment enclosingXmlEnvironment)
-
Methods inherited from class org.jivesoftware.smack.packet.Stanza
addCommonAttributes, addExtension, addExtensions, appendErrorIfExists, getDefaultLanguage, getError, getExtension, getExtension, getExtensionElement, getExtensions, getExtensions, getExtensions, getExtensions, getExtensionsMap, getFrom, getLanguage, getNamespace, getStanzaId, getTo, hasExtension, hasExtension, hasStanzaIdSet, logCommonAttributes, overrideExtension, removeExtension, setError, setFrom, setNewStanzaId, setStanzaId, setTo, throwIfNoStanzaId
-
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.XmlElement
getQName
-
-
-
-
Field Detail
-
ELEMENT
public static final String ELEMENT
- See Also:
- Constant Field Values
-
BODY
public static final String BODY
- See Also:
- Constant Field Values
-
-
Method Detail
-
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.
-
getElementName
public String getElementName()
Description copied from interface:NamedElement
Returns the root element name.- Specified by:
getElementName
in interfaceNamedElement
- Returns:
- the element name.
-
asBuilder
public MessageBuilder asBuilder()
- Specified by:
asBuilder
in classMessageOrPresence<MessageBuilder>
-
asBuilder
public MessageBuilder asBuilder(String id)
- Specified by:
asBuilder
in classMessageOrPresence<MessageBuilder>
-
asBuilder
public MessageBuilder asBuilder(XMPPConnection connection)
- Specified by:
asBuilder
in classMessageOrPresence<MessageBuilder>
-
toString
public String toString()
Description copied from class:Stanza
Returns a short String describing the Stanza. This method is suited for log purposes.
-
toXML
public XmlStringBuilder toXML(XmlEnvironment enclosingXmlEnvironment)
-
-