Package rocks.xmpp.core.stanza.model
Class StanzaError
- java.lang.Object
-
- rocks.xmpp.core.stanza.model.StanzaError
-
- All Implemented Interfaces:
LanguageElement
- Direct Known Subclasses:
ServerStanzaError
public class StanzaError extends Object implements LanguageElement
The implementation of a stanza's<error/>
element.- See Also:
- 8.3. Stanza Errors
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
StanzaError.Type
Represents a<error/>
'type' attribute.
-
Constructor Summary
Constructors Constructor Description StanzaError(Condition condition)
Creates an error with a given condition.StanzaError(Condition condition, Object extension)
Creates an error with a given condition and extension.StanzaError(Condition condition, String text)
Creates an error with a given condition and text.StanzaError(StanzaError.Type type, Condition condition)
Creates an error with a given error type and a condition.StanzaError(StanzaError.Type type, Condition condition, String text)
Creates an error with a given error type and a condition.StanzaError(StanzaError.Type type, Condition condition, String text, Locale language, Object extension, Jid by)
Creates a stanza error with all possible values.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Jid
getBy()
Gets the 'by' attribute.Condition
getCondition()
Gets the defined error condition orCondition.UNDEFINED_CONDITION
if the condition is unknown.Object
getExtension()
Gets the application specific condition, if any.Locale
getLanguage()
Gets the language of the error text.String
getText()
Gets the optional error text.StanzaError.Type
getType()
Gets the error type, either 'auth', 'cancel', 'continue', 'modify' or 'wait'.String
toString()
-
-
-
Constructor Detail
-
StanzaError
public StanzaError(StanzaError.Type type, Condition condition)
Creates an error with a given error type and a condition.The
<error/>
element MUST contain a defined condition element.- Parameters:
type
- The error type.condition
- The condition.
-
StanzaError
public StanzaError(StanzaError.Type type, Condition condition, String text)
Creates an error with a given error type and a condition.The
<error/>
element MUST contain a defined condition element.- Parameters:
type
- The error type.condition
- The condition.text
- The text.
-
StanzaError
public StanzaError(Condition condition)
Creates an error with a given condition.The error type is set by the condition's associated error type.
- Parameters:
condition
- The condition.
-
StanzaError
public StanzaError(Condition condition, String text)
Creates an error with a given condition and text.The error type is set by the condition's associated error type.
- Parameters:
condition
- The condition.text
- The text.
-
StanzaError
public StanzaError(Condition condition, Object extension)
Creates an error with a given condition and extension.The error type is set by the condition's associated error type.
- Parameters:
condition
- The condition.extension
- The extension.
-
StanzaError
public StanzaError(StanzaError.Type type, Condition condition, String text, Locale language, Object extension, Jid by)
Creates a stanza error with all possible values.- Parameters:
type
- The error type.condition
- The condition.text
- The text.language
- The language.extension
- The application specific condition.by
- The entity which returns the error.
-
-
Method Detail
-
getBy
public final Jid getBy()
Gets the 'by' attribute.The entity that returns an error stanza MAY pass along its JID to the sender of the generated stanza (e.g., for diagnostic or tracking purposes) through the addition of a 'by' attribute to the
<error/>
child element.- Returns:
- The JID.
-
getType
public final StanzaError.Type getType()
Gets the error type, either 'auth', 'cancel', 'continue', 'modify' or 'wait'.- Returns:
- The type.
-
getText
public final String getText()
Gets the optional error text.- Returns:
- The text.
-
getLanguage
public final Locale getLanguage()
Gets the language of the error text.- Specified by:
getLanguage
in interfaceLanguageElement
- Returns:
- The language.
-
getExtension
public final Object getExtension()
Gets the application specific condition, if any.8.3.4. Application-Specific Conditions
As noted, an application MAY provide application-specific stanza error information by including a properly namespaced child within the error element. Typically, the application-specific element supplements or further qualifies a defined element. Thus, the
<error/>
element will contain two or three child elements.- Returns:
- The application specific condition.
-
getCondition
public final Condition getCondition()
Gets the defined error condition orCondition.UNDEFINED_CONDITION
if the condition is unknown.- Returns:
- The error condition.
- See Also:
- 8.3.3. Defined Conditions
-
-