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 classMessage.BodyRepresents a message body, its language and the content of the message.static classMessage.SubjectRepresents a message subject, its language and the content of the subject.static classMessage.Threadstatic classMessage.TypeRepresents the type of a message.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MessageBuilderasBuilder()MessageBuilderasBuilder(java.lang.String id)MessageBuilderasBuilder(XMPPConnection connection)java.lang.StringgetElementName()Returns the root element name.Message.TypegetType()Returns the type of the message.java.lang.StringtoString()Returns a short String describing the Stanza.XmlStringBuildertoXML(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 java.lang.String ELEMENT
- See Also:
- Constant Field Values
-
BODY
public static final java.lang.String BODY
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Message
public Message(Message other)
Copy constructor.This does not perform a deep clone, as extension elements are shared between the new and old instance.
- Parameters:
other- TODO javadoc me please
-
-
Method Detail
-
getType
public Message.Type getType()
Description copied from interface:MessageViewReturns the type of the message. If no type has been set this method will returnMessage.Type.normal.- Specified by:
getTypein interfaceMessageView- Returns:
- the type of the message.
-
getElementName
public java.lang.String getElementName()
Description copied from interface:NamedElementReturns the root element name.- Specified by:
getElementNamein interfaceNamedElement- Returns:
- the element name.
-
asBuilder
public MessageBuilder asBuilder()
- Specified by:
asBuilderin classMessageOrPresence<MessageBuilder>
-
asBuilder
public MessageBuilder asBuilder(java.lang.String id)
- Specified by:
asBuilderin classMessageOrPresence<MessageBuilder>
-
asBuilder
public MessageBuilder asBuilder(XMPPConnection connection)
- Specified by:
asBuilderin classMessageOrPresence<MessageBuilder>
-
toString
public java.lang.String toString()
Description copied from class:StanzaReturns a short String describing the Stanza. This method is suited for log purposes.
-
toXML
public XmlStringBuilder toXML(XmlEnvironment enclosingXmlEnvironment)
-
-