tigase.jaxmpp.core.client.xmpp.stanzas
Class Stanza

java.lang.Object
  extended by tigase.jaxmpp.core.client.xml.ElementWrapper
      extended by tigase.jaxmpp.core.client.xmpp.stanzas.Stanza
All Implemented Interfaces:
Element
Direct Known Subclasses:
IQ, Message, Presence

public abstract class Stanza
extends ElementWrapper

Abstract representation of Stanza.


Nested Class Summary
static class Stanza.UnkownStanzaTypeException
           
 
Constructor Summary
Stanza(Element element)
           
 
Method Summary
static boolean canBeConverted(Element element)
           
static Stanza create(Element element)
          Creates new stanza.
 XMPPException.ErrorCondition getErrorCondition()
          Returns XMPPException.ErrorCondition element.
 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.
 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.xml.ElementWrapper
addChild, equals, getAsString, getAttribute, getAttributes, getChildAfter, getChildElementValue, getChildElementValue, getChildren, getChildren, getChildrenNS, getChildrenNS, getFirstChild, getFirstChild, getName, getNextSibling, getParent, getValue, getXMLNS, hashCode, removeAttribute, removeChild, setAttribute, setAttributes, setChildElementValue, setChildElementValue, setParent, setValue, setXMLNS
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Stanza

public Stanza(Element element)
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

getErrorCondition

public XMPPException.ErrorCondition getErrorCondition()
                                               throws XMLException
Returns XMPPException.ErrorCondition element.

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

getFrom

public JID getFrom()
            throws XMLException
Returns 'from' attribute.

Returns:
JID
Throws:
XMLException

getId

public String getId()
             throws XMLException
Returns id of stanza.

Returns:
id of stanza
Throws:
XMLException

getTo

public JID getTo()
          throws XMLException
Returns 'to' attribute.

Returns:
JID
Throws:
XMLException

getType

public StanzaType getType()
                   throws XMLException
Returns type of stanza.

Returns:
StanzaType. null if type not present.
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

setFrom

public void setFrom(JID jid)
             throws XMLException
Sets 'from' attribute.

Parameters:
jid - JID
Throws:
XMLException

setId

public void setId(String id)
           throws XMLException
Sets id of stanza

Parameters:
id - id
Throws:
XMLException

setTo

public void setTo(JID jid)
           throws XMLException
Sets 'to' attribute.

Parameters:
jid - JID
Throws:
XMLException

setType

public void setType(StanzaType type)
             throws XMLException
Sets type of stanza.

Parameters:
type - StanzaType
Throws:
XMLException


Copyright © 2006-2012 Tigase. All Rights Reserved.