org.xmpp.packet
Class StreamError

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

@NotThreadSafe
public class StreamError
extends java.lang.Object

A stream error. Stream errors have a condition and they can optionally include explanation text.

Author:
Matt Tucker

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

Constructor Detail

StreamError

public StreamError(StreamError.Condition condition)
Construcs a new StreamError with the specified condition.

Parameters:
condition - the error condition.

StreamError

public StreamError(StreamError.Condition condition,
                   java.lang.String text)
Constructs a new StreamError with the specified condition and error text.

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

StreamError

public StreamError(StreamError.Condition condition,
                   java.lang.String text,
                   java.lang.String language)
Constructs a new StreamError with the specified condition and error text.

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

StreamError

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

Parameters:
element - the stream error Element.
Method Detail

getCondition

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

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

setCondition

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

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

getText

public java.lang.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(java.lang.String text)
Sets the text description of the error.

Parameters:
text - the text description of the error.

setText

public void setText(java.lang.String text,
                    java.lang.String language)
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.
language - the language code of the description, or null to specify no language code.

getTextLanguage

public java.lang.String getTextLanguage()
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 java.lang.String toXML()
Returns the textual XML representation of this stream error.

Returns:
the textual XML representation of this stream error.

toString

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


Copyright © 2009-2010 Ignite Realtime. All Rights Reserved.