public abstract class AbstractMessage extends Stanza
<message/> element.
Once a client has authenticated with a server and bound a resource to an XML stream as described in [XMPP-CORE], an XMPP server will route XML stanzas to and from that client. One kind of stanza that can be exchanged is
<message/>(if, that is, messaging functionality is enabled on the server). Exchanging messages is a basic use of XMPP and occurs when a user generates a message stanza that is addressed to another entity. As defined under Section 8, the sender's server is responsible for delivering the message to the intended recipient (if the recipient is on the same local server) or for routing the message to the recipient's server (if the recipient is on a remote server). Thus a message stanza is used to "push" information to another entity.
| Modifier and Type | Class and Description |
|---|---|
static class |
AbstractMessage.Body
The implementation of a message's
<body/> element. |
static class |
AbstractMessage.Subject
The implementation of a message's
<subject/> element. |
static class |
AbstractMessage.Type
Represents a
<message/> 'type' attribute. |
| Modifier and Type | Method and Description |
|---|---|
List<AbstractMessage.Body> |
getBodies()
Gets the bodies.
|
String |
getBody()
Gets the default body (which has no language attribute).
|
<T> T |
getExtension(Class<T> type)
Gets an extension by type.
|
List<Object> |
getExtensions()
Gets all extensions.
|
String |
getParentThread()
Gets the parent thread.
|
String |
getSubject()
Gets the default subject (which has no language attribute).
|
List<AbstractMessage.Subject> |
getSubjects()
Gets the subjects.
|
String |
getThread()
Gets the thread.
|
AbstractMessage.Type |
getType()
Gets the message type.
|
void |
setBody(String body)
Deprecated.
Use constructor.
|
void |
setParentThread(String parent)
Deprecated.
Use constructor.
|
void |
setSubject(String subject)
Deprecated.
Use constructor.
|
void |
setThread(String thread)
Deprecated.
Use constructor.
|
void |
setType(AbstractMessage.Type type)
Deprecated.
Use constructor.
|
String |
toString() |
createError, createError, getError, getFrom, getId, getLanguage, getTo, setError, setFrom, setId, setLanguage, setTo, withFrompublic final List<AbstractMessage.Body> getBodies()
Multiple instances of the
<body/>element MAY be included in a message stanza for the purpose of providing alternate versions of the same body, but only if each instance possesses an 'xml:lang' attribute with a distinct language value.
getBody()public final String getBody()
If there's no default body, but only bodies with a language attribute, the first body is returned.The
<body/>element contains human-readable XML character data that specifies the textual contents of the message; this child element is normally included but is OPTIONAL.
If there are no bodies at all, null is returned.
getBodies()@Deprecated public final void setBody(String body)
body - The body text.getBody()public final List<AbstractMessage.Subject> getSubjects()
Multiple instances of the
<subject/>element MAY be included for the purpose of providing alternate versions of the same subject, but only if each instance possesses an 'xml:lang' attribute with a distinct language value.
getSubject()public final String getSubject()
The
<subject/>element contains human-readable XML character data that specifies the topic of the message.
If there's no default subject, but only subjects with a language attribute, the first subject is returned.
If there are no subjects at all, null is returned.
getSubjects()@Deprecated public final void setSubject(String subject)
subject - The subject text.getSubject()public final AbstractMessage.Type getType()
Common uses of the message stanza in instant messaging applications include: single messages; messages sent in the context of a one-to-one chat session; messages sent in the context of a multi-user chat room; alerts, notifications, or other information to which no reply is expected; and errors. These uses are differentiated via the 'type' attribute.
@Deprecated public final void setType(AbstractMessage.Type type)
type - The message type.getType()public final String getThread()
The primary use of the XMPP
<thread/>element is to uniquely identify a conversation thread or "chat session" between two entities instantiated by<message/>stanzas of type 'chat'. However, the XMPP<thread/>element MAY also be used to uniquely identify an analogous thread between two entities instantiated by<message/>stanzas of type 'headline' or 'normal', or among multiple entities in the context of a multi-user chat room instantiated by<message/>stanzas of type 'groupchat'. It MAY also be used for<message/>stanzas not related to a human conversation, such as a game session or an interaction between plugins. The<thread/>element is not used to identify individual messages, only conversations or messaging sessions.
@Deprecated public final void setThread(String thread)
thread - The thread.getThread()public final String getParentThread()
The
<thread/>element MAY possess a 'parent' attribute that identifies another thread of which the current thread is an offshoot or child. The 'parent' attribute MUST conform to the syntax of the<thread/>element itself and its value MUST be different from the XML character data of the<thread/>element on which the 'parent' attribute is included.
@Deprecated public final void setParentThread(String parent)
parent - The parent thread.getParentThread()public final List<Object> getExtensions()
public final <T> T getExtension(Class<T> type)
StanzagetExtension in class StanzaT - The type.type - The class.Copyright © 2014–2015 XMPP.rocks. All rights reserved.