public final class StanzaError
extends java.lang.Object
The implementation of a stanza’s <error/>
element.
This class is immutable.
Modifier and Type | Class and Description |
---|---|
static class |
StanzaError.Type
Represents a
<error/> ‘type’ attribute. |
Constructor and Description |
---|
StanzaError(Condition condition)
Creates an error with a given condition.
|
StanzaError(Condition condition,
java.lang.Object extension)
Creates an error with a given condition and extension.
|
StanzaError(Condition condition,
java.lang.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,
java.lang.String text)
Creates an error with a given error type and a condition.
|
StanzaError(StanzaError.Type type,
Condition condition,
java.lang.String text,
java.util.Locale language,
java.lang.Object extension,
Jid by)
Creates a stanza error with all possible values.
|
Modifier and Type | Method and Description |
---|---|
Jid |
getBy()
Gets the ‘by’ attribute.
|
Condition |
getCondition()
Gets the defined error condition or
Condition.UNDEFINED_CONDITION if the condition is unknown. |
java.lang.Object |
getExtension()
Gets the application specific condition, if any.
|
java.util.Locale |
getLanguage()
Gets the language of the error text.
|
java.lang.String |
getText()
Gets the optional error text.
|
StanzaError.Type |
getType()
Gets the error type, either ‘auth’, ‘cancel’, ‘continue’, ‘modify’ or ‘wait’.
|
java.lang.String |
toString() |
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.
type
- The error type.condition
- The condition.public StanzaError(StanzaError.Type type, Condition condition, java.lang.String text)
Creates an error with a given error type and a condition.
The
<error/>
element MUST contain a defined condition element.
type
- The error type.condition
- The condition.text
- The text.public StanzaError(Condition condition)
Creates an error with a given condition.
The error type is set by the condition’s associated error type.
condition
- The condition.public StanzaError(Condition condition, java.lang.String text)
Creates an error with a given condition and text.
The error type is set by the condition’s associated error type.
condition
- The condition.text
- The text.public StanzaError(Condition condition, java.lang.Object extension)
Creates an error with a given condition and extension.
The error type is set by the condition’s associated error type.
condition
- The condition.extension
- The extension.public StanzaError(StanzaError.Type type, Condition condition, java.lang.String text, java.util.Locale language, java.lang.Object extension, Jid by)
Creates a stanza error with all possible values.
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.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.
public final StanzaError.Type getType()
Gets the error type, either ‘auth’, ‘cancel’, ‘continue’, ‘modify’ or ‘wait’.
public final java.lang.String getText()
Gets the optional error text.
public final java.util.Locale getLanguage()
Gets the language of the error text.
public final java.lang.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.
public final Condition getCondition()
Gets the defined error condition or Condition.UNDEFINED_CONDITION
if the condition is unknown.
public final java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2014–2019 XMPP.rocks. All rights reserved.