public abstract class StanzaBuilder<B extends StanzaBuilder<B>> extends java.lang.Object implements StanzaView
| Modifier | Constructor and Description |
|---|---|
protected |
StanzaBuilder(StanzaBuilder<?> other) |
protected |
StanzaBuilder(StanzaIdSource stanzaIdSource) |
protected |
StanzaBuilder(Stanza message,
StanzaIdSource stanzaIdSource) |
protected |
StanzaBuilder(Stanza message,
java.lang.String stanzaId) |
protected |
StanzaBuilder(java.lang.String stanzaId) |
| Modifier and Type | Method and Description |
|---|---|
B |
addExtension(ExtensionElement extensionElement) |
B |
addExtensions(java.util.Collection<? extends ExtensionElement> extensionElements) |
B |
addOptExtensions(java.util.Collection<? extends ExtensionElement> extensionElements) |
protected abstract void |
addStanzaSpecificAttributes(ToStringUtil.Builder builder) |
abstract Stanza |
build() |
static IqData |
buildIqData(java.lang.String stanzaId) |
static MessageBuilder |
buildMessage() |
static MessageBuilder |
buildMessage(java.lang.String stanzaId) |
static MessageBuilder |
buildMessageFrom(Message message,
StanzaIdSource stanzaIdSource) |
static MessageBuilder |
buildMessageFrom(Message message,
java.lang.String stanzaId) |
static PresenceBuilder |
buildPresence() |
static PresenceBuilder |
buildPresence(java.lang.String stanzaId) |
static PresenceBuilder |
buildPresenceFrom(Presence presence,
StanzaIdSource stanzaIdSource) |
static PresenceBuilder |
buildPresenceFrom(Presence presence,
java.lang.String stanzaId) |
static <SB extends StanzaBuilder<?>> |
buildResponse(StanzaView request,
Function<SB,java.lang.String> builderFromStanzaId) |
B |
from(java.lang.CharSequence from)
Sets who the the stanza is being sent "from".
|
B |
from(org.jxmpp.jid.Jid from)
Sets who the stanza is being sent "from".
|
StanzaError |
getError()
Returns the error associated with this packet, or
null if there are
no errors. |
ExtensionElement |
getExtension(javax.xml.namespace.QName qname) |
java.util.List<ExtensionElement> |
getExtensions()
Returns a list of all extension elements of this stanza.
|
<E extends ExtensionElement> |
getExtensions(java.lang.Class<E> extensionElementClass)
Return all extension elements of the given type.
|
java.util.List<ExtensionElement> |
getExtensions(javax.xml.namespace.QName qname) |
org.jxmpp.jid.Jid |
getFrom()
Returns who the stanza is being sent "from" or
null if
the value is not set. |
java.lang.String |
getLanguage()
Returns the xml:lang of this XML element, or null if one has not been set.
|
java.lang.String |
getStanzaId()
Returns the unique ID of the stanza.
|
abstract B |
getThis() |
org.jxmpp.jid.Jid |
getTo()
Returns who the stanza is being sent "to", or
null if
the value is not set. |
B |
overrideExtension(ExtensionElement extensionElement) |
B |
removeExtension(ExtensionElement extension) |
B |
removeExtension(java.lang.String elementName,
java.lang.String namespace) |
B |
setError(StanzaError stanzaError)
Sets the error for this stanza.
|
B |
setLanguage(java.lang.String language)
Sets the xml:lang for this stanza.
|
void |
throwIfNoStanzaId() |
B |
to(java.lang.CharSequence to)
Set the recipent address of the stanza.
|
B |
to(org.jxmpp.jid.Jid to)
Sets who the stanza is being sent "to".
|
java.lang.String |
toString() |
boolean |
willBuildStanzaWithId() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetExtension, hasExtension, hasExtension, hasExtensionprotected StanzaBuilder(StanzaBuilder<?> other)
protected StanzaBuilder(StanzaIdSource stanzaIdSource)
protected StanzaBuilder(java.lang.String stanzaId)
protected StanzaBuilder(Stanza message, java.lang.String stanzaId)
protected StanzaBuilder(Stanza message, StanzaIdSource stanzaIdSource)
public final B to(java.lang.CharSequence to) throws org.jxmpp.stringprep.XmppStringprepException
to - whoe the stanza is being sent to.org.jxmpp.stringprep.XmppStringprepException - if the provided character sequence is not a valid XMPP address.to(Jid)public final B to(org.jxmpp.jid.Jid to)
to - who the stanza is being sent to.public final B from(java.lang.CharSequence from) throws org.jxmpp.stringprep.XmppStringprepException
from - who the stanza is being sent from.org.jxmpp.stringprep.XmppStringprepException - if the provided character sequence is not a valid XMPP address.from(Jid)public final B from(org.jxmpp.jid.Jid from)
from - who the stanza is being sent from.public final B setError(StanzaError stanzaError)
stanzaError - the error to associate with this stanza.public final B setLanguage(java.lang.String language)
language - the xml:lang of this stanza.public final B addExtension(ExtensionElement extensionElement)
public final B addOptExtensions(java.util.Collection<? extends ExtensionElement> extensionElements)
public final B addExtensions(java.util.Collection<? extends ExtensionElement> extensionElements)
public final B overrideExtension(ExtensionElement extensionElement)
public final B removeExtension(java.lang.String elementName, java.lang.String namespace)
public final B removeExtension(ExtensionElement extension)
public abstract Stanza build()
public abstract B getThis()
public final java.lang.String getStanzaId()
StanzaViewnull.getStanzaId in interface StanzaViewnull if the id is not available.public final org.jxmpp.jid.Jid getTo()
StanzaViewnull if
the value is not set. The XMPP protocol often makes the "to"
attribute optional, so it does not always need to be set.getTo in interface StanzaViewnull if the
value has not been set.public final org.jxmpp.jid.Jid getFrom()
StanzaViewnull if
the value is not set. The XMPP protocol often makes the "from"
attribute optional, so it does not always need to be set.getFrom in interface StanzaViewnull if the
value has not been set.public final java.lang.String getLanguage()
XmlLangElementgetLanguage in interface XmlLangElementpublic final StanzaError getError()
StanzaViewnull if there are
no errors.getError in interface StanzaViewnull if there isn't an error.public final ExtensionElement getExtension(javax.xml.namespace.QName qname)
getExtension in interface StanzaViewpublic final java.util.List<ExtensionElement> getExtensions()
StanzaViewgetExtensions in interface StanzaViewpublic final java.util.List<ExtensionElement> getExtensions(javax.xml.namespace.QName qname)
getExtensions in interface StanzaViewpublic final <E extends ExtensionElement> java.util.List<E> getExtensions(java.lang.Class<E> extensionElementClass)
StanzaViewgetExtensions in interface StanzaViewE - the type of extension elements.extensionElementClass - the class of the type of extension elements.public final boolean willBuildStanzaWithId()
public final void throwIfNoStanzaId()
protected abstract void addStanzaSpecificAttributes(ToStringUtil.Builder builder)
public final java.lang.String toString()
toString in class java.lang.Objectpublic static MessageBuilder buildMessage()
public static MessageBuilder buildMessage(java.lang.String stanzaId)
public static MessageBuilder buildMessageFrom(Message message, java.lang.String stanzaId)
public static MessageBuilder buildMessageFrom(Message message, StanzaIdSource stanzaIdSource)
public static PresenceBuilder buildPresence()
public static PresenceBuilder buildPresence(java.lang.String stanzaId)
public static PresenceBuilder buildPresenceFrom(Presence presence, java.lang.String stanzaId)
public static PresenceBuilder buildPresenceFrom(Presence presence, StanzaIdSource stanzaIdSource)
public static IqData buildIqData(java.lang.String stanzaId)
public static <SB extends StanzaBuilder<?>> SB buildResponse(StanzaView request, Function<SB,java.lang.String> builderFromStanzaId)