Openfire 3.4.3 Javadoc

org.xmpp.packet
Class PacketError

java.lang.Object
  extended by org.xmpp.packet.PacketError

public class PacketError
extends Object

A packet error. Errors must have a type and condition. Optionally, they can include explanation text.

Author:
Matt Tucker

Nested Class Summary
static class PacketError.Condition
          Type-safe enumeration for the error condition.
static class PacketError.Type
          Error type.
 
Constructor Summary
PacketError(org.dom4j.Element element)
          Constructs a new PacketError using an existing Element.
PacketError(PacketError.Condition condition)
          Construcs a new PacketError with the specified condition.
PacketError(PacketError.Condition condition, PacketError.Type type)
          Constructs a new PacketError with the specified condition and type.
PacketError(PacketError.Condition condition, PacketError.Type type, String text)
          Constructs a new PacketError.
PacketError(PacketError.Condition condition, PacketError.Type type, String text, String lang)
          Constructs a new PacketError.
 
Method Summary
 PacketError.Condition getCondition()
          Returns the error condition.
 org.dom4j.Element getElement()
          Returns the DOM4J Element that backs the error.
 String getText()
          Returns a text description of the error, or null if there is no text description.
 String getTextLang()
          Returns the text description's language code, or null if there is no language code associated with the description text.
 PacketError.Type getType()
          Returns the error type.
 void setCondition(PacketError.Condition condition)
          Sets the error condition.
 void setText(String text)
          Sets the text description of the error.
 void setText(String text, String lang)
          Sets the text description of the error.
 void setType(PacketError.Type type)
          Sets the error type.
 String toString()
           
 String toXML()
          Returns the textual XML representation of this error.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PacketError

public PacketError(PacketError.Condition condition)
Construcs a new PacketError with the specified condition. The error type will be set to the default for the specified condition.

Parameters:
condition - the error condition.

PacketError

public PacketError(PacketError.Condition condition,
                   PacketError.Type type)
Constructs a new PacketError with the specified condition and type.

Parameters:
condition - the error condition.
type - the error type.

PacketError

public PacketError(PacketError.Condition condition,
                   PacketError.Type type,
                   String text)
Constructs a new PacketError.

Parameters:
type - the error type.
condition - the error condition.
text - the text description of the error.

PacketError

public PacketError(PacketError.Condition condition,
                   PacketError.Type type,
                   String text,
                   String lang)
Constructs a new PacketError.

Parameters:
type - the error type.
condition - the error condition.
text - the text description of the error.
lang - the language code of the error description (e.g. "en").

PacketError

public PacketError(org.dom4j.Element element)
Constructs a new PacketError using an existing Element. This is useful for parsing incoming error Elements into PacketError objects.

Parameters:
element - the error Element.
Method Detail

getType

public PacketError.Type getType()
Returns the error type.

Returns:
the error type.
See Also:
PacketError.Type

setType

public void setType(PacketError.Type type)
Sets the error type.

Parameters:
type - the error type.
See Also:
PacketError.Type

getCondition

public PacketError.Condition getCondition()
Returns the error condition.

Returns:
the error condition.
See Also:
PacketError.Condition

setCondition

public void setCondition(PacketError.Condition condition)
Sets the error condition.

Parameters:
condition - the error condition.
See Also:
PacketError.Condition

getText

public String getText()
Returns a text description of the error, or null if there is no text description.

Returns:
the text description of the error.

setText

public void setText(String text)
Sets the text description of the error.

Parameters:
text - the text description of the error.

setText

public void setText(String text,
                    String lang)
Sets the text description of the error. Optionally, a language code can be specified to indicate the language of the description.

Parameters:
text - the text description of the error.
lang - the language code of the description, or null to specify no language code.

getTextLang

public String getTextLang()
Returns the text description's language code, or null if there is no language code associated with the description text.

Returns:
the language code of the text description, if it exists.

getElement

public org.dom4j.Element getElement()
Returns the DOM4J Element that backs the error. The element is the definitive representation of the error and can be manipulated directly to change error contents.

Returns:
the DOM4J Element.

toXML

public String toXML()
Returns the textual XML representation of this error.

Returns:
the textual XML representation of this error.

toString

public String toString()
Overrides:
toString in class Object

Openfire 3.4.3 Javadoc

Copyright © 2003-2007 Jive Software.