tigase.jaxmpp.core.client.xmpp.stanzas

## Class Stanza

- java.lang.Object
- - tigase.jaxmpp.core.client.xml.ElementWrapper
  - - tigase.jaxmpp.core.client.xmpp.stanzas.StreamPacket
    - - tigase.jaxmpp.core.client.xmpp.stanzas.Stanza

- All Implemented Interfaces:
    Element
  Direct Known Subclasses:
    IQ, Message, Presence

      public abstract class Stanza
      extends StreamPacket

  Abstract representation of Stanza.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `Stanza.UnkownStanzaTypeException`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addFlag(String flag)`
    `static boolean` | `canBeConverted(Element element)`
    `static Stanza` | `create(Element element)` Creates new stanza.
    `static IQ` | `createIQ()`
    `static Message` | `createMessage()`
    `static Presence` | `createPresence()`
    `XMPPException.ErrorCondition` | `getErrorCondition()` Returns XMPPException.ErrorCondition element.
    `String` | `getErrorMessage()`
    `JID` | `getFrom()` Returns 'from' attribute.
    `String` | `getId()` Returns id of stanza.
    `JID` | `getTo()` Returns 'to' attribute.
    `StanzaType` | `getType()` Returns type of stanza.
    `StanzaType` | `getType(StanzaType defaultValue)` Returns type of stanza.
    `boolean` | `hasFlag(String flag)`
    `void` | `removeFlag(String flag)`
    `void` | `setFrom(JID jid)` Sets 'from' attribute.
    `void` | `setId(String id)` Sets id of stanza
    `void` | `setTo(JID jid)` Sets 'to' attribute.
    `void` | `setType(StanzaType type)` Sets type of stanza.

    - ### Methods inherited from class tigase.jaxmpp.core.client.xmpp.stanzas.StreamPacket

      `getXmppStream, setXmppStream`

    - ### Methods inherited from class tigase.jaxmpp.core.client.xml.ElementWrapper

      `addChild, equals, findChild, getAsString, getAttribute, getAttributes, getChildAfter, getChildElementValue, getChildElementValue, getChildren, getChildren, getChildrenNS, getChildrenNS, getFirstChild, getFirstChild, getName, getNextSibling, getParent, getValue, getWrappedElement, getXMLNS, hashCode, removeAttribute, removeChild, setAttribute, setAttributes, setChildElementValue, setChildElementValue, setParent, setValue, setXMLNS, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Method Detail

    - #### canBeConverted

          public static boolean canBeConverted(Element element)
                                        throws XMLException

      Throws:
        `XMLException`

    - #### create

          public static final Stanza create(Element element)
                                     throws JaxmppException

      Creates new stanza.
      Parameters:
        `element` - element containing stanza.
      Returns:
        specific implementation od Stanza: IQ, Message or Presence.
      Throws:
        `JaxmppException`

    - #### createIQ

          public static final IQ createIQ()
                                   throws JaxmppException

      Throws:
        `JaxmppException`

    - #### createMessage

          public static final Message createMessage()
                                             throws JaxmppException

      Throws:
        `JaxmppException`

    - #### createPresence

          public static final Presence createPresence()
                                               throws JaxmppException

      Throws:
        `JaxmppException`

    - #### hasFlag

          public boolean hasFlag(String flag)

    - #### addFlag

          public void addFlag(String flag)

    - #### removeFlag

          public void removeFlag(String flag)

    - #### getErrorCondition

          public XMPPException.ErrorCondition getErrorCondition()
                                                         throws XMLException

      Returns XMPPException.ErrorCondition element.
      Returns:
        XMPPException.ErrorCondition. `null` is element not present.
      Throws:
        `XMLException`

    - #### getErrorMessage

          public String getErrorMessage()
                                 throws XMLException

      Throws:
        `XMLException`

    - #### getFrom

          public JID getFrom()
                      throws XMLException

      Returns 'from' attribute.
      Returns:
        JID
      Throws:
        `XMLException`

    - #### setFrom

          public void setFrom(JID jid)
                       throws XMLException

      Sets 'from' attribute.
      Parameters:
        `jid` - JID
      Throws:
        `XMLException`

    - #### getId

          public String getId()
                       throws XMLException

      Returns id of stanza.
      Returns:
        id of stanza
      Throws:
        `XMLException`

    - #### setId

          public void setId(String id)
                     throws XMLException

      Sets id of stanza
      Parameters:
        `id` - id
      Throws:
        `XMLException`

    - #### getTo

          public JID getTo()
                    throws XMLException

      Returns 'to' attribute.
      Returns:
        JID
      Throws:
        `XMLException`

    - #### setTo

          public void setTo(JID jid)
                     throws XMLException

      Sets 'to' attribute.
      Parameters:
        `jid` - JID
      Throws:
        `XMLException`

    - #### getType

          public StanzaType getType()
                             throws XMLException

      Returns type of stanza.
      Returns:
        StanzaType. `null` if type not present.
      Throws:
        `XMLException`

    - #### setType

          public void setType(StanzaType type)
                       throws XMLException

      Sets type of stanza.
      Parameters:
        `type` - StanzaType
      Throws:
        `XMLException`

    - #### getType

          public StanzaType getType(StanzaType defaultValue)
                             throws XMLException

      Returns type of stanza.
      Parameters:
        `defaultValue` - default value. Will be returned if type of stanza id `null`.
      Returns:
        StanzaType. `defaultValue` if type not present.
      Throws:
        `XMLException`

Copyright © 2006–2020 Tigase. All rights reserved.