public class Status extends Object
Modifier and Type | Field and Description |
---|---|
static String |
STATUS_MISSING_ATTRIBUTE
Standard identifier for the MissingAttribute status
|
static String |
STATUS_OK
Standard identifier for the OK status
|
static String |
STATUS_PROCESSING_ERROR
Standard identifier for the ProcessingError status
|
static String |
STATUS_SYNTAX_ERROR
Standard identifier for the SyntaxError status
|
Constructor and Description |
---|
Status(List<String> code)
Constructor that takes only the status code.
|
Status(List<String> code,
String message)
Constructor that takes both the status code and a message to include with the status.
|
Status(List<String> code,
String message,
StatusDetail detail)
Constructor that takes the status code, an optional message, and some detail to include with
the status.
|
Modifier and Type | Method and Description |
---|---|
String |
encode()
Encodes this
Status into its XML form |
void |
encode(StringBuilder builder)
Encodes this
Status into its XML form and writes this out to the provided
StringBuilder |
List<String> |
getCode()
Returns the status code.
|
StatusDetail |
getDetail()
Returns the status detail or null if there is none.
|
static Status |
getInstance(Node root)
Creates a new instance of
Status based on the given DOM root node. |
String |
getMessage()
Returns the status message or null if there is none.
|
static Status |
getOkInstance()
Gets a
Status instance that has the OK status and no other information. |
public static final String STATUS_OK
public static final String STATUS_MISSING_ATTRIBUTE
public static final String STATUS_SYNTAX_ERROR
public static final String STATUS_PROCESSING_ERROR
public Status(List<String> code)
code
- a List
of String
codes, typically just one code, but
this may contain any number of minor codes after the first item in the list, which
is the major codepublic Status(List<String> code, String message)
code
- a List
of String
codes, typically just one code, but
this may contain any number of minor codes after the first item in the list, which
is the major codemessage
- a message to include with the codepublic Status(List<String> code, String message, StatusDetail detail) throws IllegalArgumentException
code
- a List
of String
codes, typically just one code, but
this may contain any number of minor codes after the first item in the list, which
is the major codemessage
- a message to include with the code, or null if there should be no messagedetail
- the status detail to include, or null if there is no detailIllegalArgumentException
- if detail is included for a status code that doesn't allow
detailpublic String getMessage()
public StatusDetail getDetail()
StatusDetail
or nullpublic static Status getOkInstance()
Status
instance that has the OK status and no other information. This is
the default status data for all responses except Indeterminate ones.STATUS_OK
public static Status getInstance(Node root) throws ParsingException
Status
based on the given DOM root node. A
ParsingException
is thrown if the DOM root doesn't represent a valid StatusType.root
- the DOM root of a StatusTypeStatus
ParsingException
- if the node is invalidpublic String encode()
Status
into its XML formString
public void encode(StringBuilder builder)
Status
into its XML form and writes this out to the provided
StringBuilder
builder
- string stream into which the XML-encoded data is writtenCopyright © 2020 WSO2. All rights reserved.