Package org.xmpp.packet
Class PacketError
java.lang.Object
org.xmpp.packet.PacketError
A packet error. Errors must have a type and condition. Optionally, they
can include explanation text.
- Author:
- Matt Tucker
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumType-safe enumeration for the error condition.static enumError type. -
Constructor Summary
ConstructorsConstructorDescriptionPacketError(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
Modifier and TypeMethodDescriptionReturns the name of the application-specific error condition, ornullif there is no application-specific error.Returns the namespace of the application-specific error condition, ornullif there is no application-specific error.Returns the error condition.org.dom4j.ElementReturns the DOM4J Element that backs the error.getText()Returns a text description of the error, ornullif there is no text description.Returns the text description's language code, ornullif there is no language code associated with the description text.getType()Returns the error type.voidSets an application-specific error condition.voidsetApplicationCondition(String name, String namespaceURI) Sets an application-specific error condition.voidsetCondition(PacketError.Condition condition) Sets the error condition.voidSets the text description of the error.voidSets the text description of the error.voidsetType(PacketError.Type type) Sets the error type.toString()toXML()Returns the textual XML representation of this error.
-
Constructor Details
-
PacketError
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
Constructs a new PacketError with the specified condition and type.- Parameters:
condition- the error condition.type- the error type.
-
PacketError
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 Details
-
getType
Returns the error type.- Returns:
- the error type.
- See Also:
-
setType
Sets the error type.- Parameters:
type- the error type.- See Also:
-
getCondition
Returns the error condition.- Returns:
- the error condition.
- See Also:
-
setCondition
Sets the error condition.- Parameters:
condition- the error condition.- See Also:
-
getText
Returns a text description of the error, ornullif there is no text description.- Returns:
- the text description of the error.
-
setText
Sets the text description of the error.- Parameters:
text- the text description of the error.
-
setText
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, ornullto specify no language code.
-
getTextLang
Returns the text description's language code, ornullif there is no language code associated with the description text.- Returns:
- the language code of the text description, if it exists.
-
setApplicationCondition
Sets an application-specific error condition.- Parameters:
name- the name of the application-specific error condition.
-
setApplicationCondition
Sets an application-specific error condition. Optionally, a application-specific namespace can be specified to define its own application-specific error .- Parameters:
name- the name of the application-specific error condition.namespaceURI- the namespace of the application.
-
getApplicationConditionName
Returns the name of the application-specific error condition, ornullif there is no application-specific error.- Returns:
- the name of the application-specific error condition, if it exists.
-
getApplicationConditionNamespaceURI
Returns the namespace of the application-specific error condition, ornullif there is no application-specific error.- Returns:
- the namespace of the application-specific error condition, 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
Returns the textual XML representation of this error.- Returns:
- the textual XML representation of this error.
-
toString
-