Class StanzaBuilder<B extends StanzaBuilder<B>>

    • Constructor Detail

      • StanzaBuilder

        protected StanzaBuilder​(StanzaBuilder<?> other)
      • StanzaBuilder

        protected StanzaBuilder​(StanzaIdSource stanzaIdSource)
      • StanzaBuilder

        protected StanzaBuilder​(java.lang.String stanzaId)
      • StanzaBuilder

        protected StanzaBuilder​(Stanza message,
                                java.lang.String stanzaId)
    • Method Detail

      • to

        public final B to​(java.lang.CharSequence to)
                   throws org.jxmpp.stringprep.XmppStringprepException
        Set the recipent address of the stanza.
        Parameters:
        to - whoe the stanza is being sent to.
        Returns:
        a reference to this builder.
        Throws:
        org.jxmpp.stringprep.XmppStringprepException - if the provided character sequence is not a valid XMPP address.
        See Also:
        to(Jid)
      • to

        public final B to​(org.jxmpp.jid.Jid to)
        Sets who the stanza is being sent "to". The XMPP protocol often makes the "to" attribute optional, so it does not always need to be set.
        Parameters:
        to - who the stanza is being sent to.
        Returns:
        a reference to this builder.
      • from

        public final B from​(java.lang.CharSequence from)
                     throws org.jxmpp.stringprep.XmppStringprepException
        Sets who the the stanza is being sent "from".
        Parameters:
        from - who the stanza is being sent from.
        Returns:
        a reference to this builder.
        Throws:
        org.jxmpp.stringprep.XmppStringprepException - if the provided character sequence is not a valid XMPP address.
        See Also:
        from(Jid)
      • from

        public final B from​(org.jxmpp.jid.Jid from)
        Sets who the stanza is being sent "from". The XMPP protocol often makes the "from" attribute optional, so it does not always need to be set.
        Parameters:
        from - who the stanza is being sent from.
        Returns:
        a reference to this builder.
      • setError

        public final B setError​(StanzaError stanzaError)
        Sets the error for this stanza.
        Parameters:
        stanzaError - the error to associate with this stanza.
        Returns:
        a reference to this builder.
      • setLanguage

        public final B setLanguage​(java.lang.String language)
        Sets the xml:lang for this stanza.
        Parameters:
        language - the xml:lang of this stanza.
        Returns:
        a reference to this builder.
      • addOptExtensions

        public final B addOptExtensions​(java.util.Collection<? extends ExtensionElement> extensionElements)
      • addExtensions

        public final B addExtensions​(java.util.Collection<? extends ExtensionElement> extensionElements)
      • overrideExtension

        public final B overrideExtension​(ExtensionElement extensionElement)
      • build

        public abstract Stanza build()
      • getThis

        public abstract B getThis()
      • getStanzaId

        public final java.lang.String getStanzaId()
        Description copied from interface: StanzaView
        Returns the unique ID of the stanza. The returned value could be null.
        Specified by:
        getStanzaId in interface StanzaView
        Returns:
        the packet's unique ID or null if the id is not available.
      • getTo

        public final org.jxmpp.jid.Jid getTo()
        Description copied from interface: StanzaView
        Returns who the stanza is being sent "to", or null if the value is not set. The XMPP protocol often makes the "to" attribute optional, so it does not always need to be set.

        Specified by:
        getTo in interface StanzaView
        Returns:
        who the stanza is being sent to, or null if the value has not been set.
      • getFrom

        public final org.jxmpp.jid.Jid getFrom()
        Description copied from interface: StanzaView
        Returns who the stanza is being sent "from" or null if the value is not set. The XMPP protocol often makes the "from" attribute optional, so it does not always need to be set.

        Specified by:
        getFrom in interface StanzaView
        Returns:
        who the stanza is being sent from, or null if the value has not been set.
      • getLanguage

        public final java.lang.String getLanguage()
        Description copied from interface: XmlLangElement
        Returns the xml:lang of this XML element, or null if one has not been set.
        Specified by:
        getLanguage in interface XmlLangElement
        Returns:
        the xml:lang of this XML element, or null.
      • getError

        public final StanzaError getError()
        Description copied from interface: StanzaView
        Returns the error associated with this packet, or null if there are no errors.
        Specified by:
        getError in interface StanzaView
        Returns:
        the error sub-packet or null if there isn't an error.
      • getExtensions

        public final java.util.List<ExtensionElement> getExtensions()
        Description copied from interface: StanzaView
        Returns a list of all extension elements of this stanza.
        Specified by:
        getExtensions in interface StanzaView
        Returns:
        a list of all extension elements of this stanza.
      • getExtensions

        public final <E extends ExtensionElement> java.util.List<E> getExtensions​(java.lang.Class<E> extensionElementClass)
        Description copied from interface: StanzaView
        Return all extension elements of the given type. Returns the empty list if there a none.
        Specified by:
        getExtensions in interface StanzaView
        Type Parameters:
        E - the type of extension elements.
        Parameters:
        extensionElementClass - the class of the type of extension elements.
        Returns:
        a list of extension elements of that type, which may be empty.
      • willBuildStanzaWithId

        public final boolean willBuildStanzaWithId()
      • throwIfNoStanzaId

        public final void throwIfNoStanzaId()
      • addStanzaSpecificAttributes

        protected abstract void addStanzaSpecificAttributes​(ToStringUtil.Builder builder)
      • toString

        public final java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • buildMessage

        public static MessageBuilder buildMessage​(java.lang.String stanzaId)
      • buildMessageFrom

        public static MessageBuilder buildMessageFrom​(Message message,
                                                      java.lang.String stanzaId)
      • buildPresence

        public static PresenceBuilder buildPresence​(java.lang.String stanzaId)
      • buildPresenceFrom

        public static PresenceBuilder buildPresenceFrom​(Presence presence,
                                                        java.lang.String stanzaId)
      • buildIqData

        public static IqData buildIqData​(java.lang.String stanzaId)
      • buildResponse

        public static <SB extends StanzaBuilder<?>> SB buildResponse​(StanzaView request,
                                                                     Function<SB,​java.lang.String> builderFromStanzaId)