Class StatusItem

A StatusItem holds all the status information. Multi StatusItems are bundled together into a Status.

PropertyDescription
code: StringThe status code is the unique identifier for the message and can be used by client programs to check for a specific status and to generate a localized message.
details: Map (read-only)Returns the optional details for this StatusItem.
error: Boolean (read-only)Returns whether this Status Item represents and error.
message: StringReturns the default human readable message for this Status.
parameters: ListReturns the parameters to construct a custom message.
status: NumberReturns the status.
ConstructorDescription
StatusItem()Constructs a new OK StatusItem.
StatusItem(Number)Constructs a new StatusItem with the given status.
StatusItem(Number, String)Constructs a new StatusItem with the given status and code.
StatusItem(Number, String, String, Object...)Constructs a new StatusItem with the given values.
MethodDescription
addDetail(String, Object)Add an additional detail to this StatusItem.
getCode()The status code is the unique identifier for the message and can be used by client programs to check for a specific status and to generate a localized message.
getDetails()Returns the optional details for this StatusItem.
getMessage()Returns the default human readable message for this Status.
getParameters()Returns the parameters to construct a custom message.
getStatus()Returns the status.
isError()Returns whether this Status Item represents and error.
setCode(String)Method to set the status code.
setMessage(String)Sets the default human readable message for this Status.
setParameters(Object[])Sets the parameters for a custom message.
setStatus(Number)Set the status.

assign, create, create, defineProperties, defineProperty, entries, freeze, fromEntries, getOwnPropertyDescriptor, getOwnPropertyNames, getOwnPropertySymbols, getPrototypeOf, hasOwnProperty, is, isExtensible, isFrozen, isPrototypeOf, isSealed, keys, preventExtensions, propertyIsEnumerable, seal, setPrototypeOf, toLocaleString, toString, valueOf, values

code: String

The status code is the unique identifier for the message and can be used by client programs to check for a specific status and to generate a localized message.


details: Map (read-only)

Returns the optional details for this StatusItem.


error: Boolean (read-only)

Returns whether this Status Item represents and error.


message: String

Returns the default human readable message for this Status.

Note: Custom code and client programs must not use this message to identify a specific status. The getCode() must be used for that purpose. The actual message can change from release to release.


parameters: List

Returns the parameters to construct a custom message.


status: Number

Returns the status.


StatusItem()

Constructs a new OK StatusItem.


StatusItem(status: Number)

Constructs a new StatusItem with the given status.

Parameters:


StatusItem(status: Number, code: String)

Constructs a new StatusItem with the given status and code.

Parameters:

  • status - either Status.OK or Status.ERROR.
  • code - a string representing a more detailed status code, e.g. "IMPEX-120".

StatusItem(status: Number, code: String, message: String, parameters: Object...)

Constructs a new StatusItem with the given values.

Parameters:

  • status - Status.OK or Status.ERROR.
  • code - a string representing a more detailed status code, e.g. "IMPEX-120".
  • message - a default human readable message
  • parameters - a list of parameters to construct a custom message

addDetail(key: String, value: Object): void

Add an additional detail to this StatusItem.

Parameters:

  • key - the key for the detail.
  • value - the detail value.

getCode(): String

The status code is the unique identifier for the message and can be used by client programs to check for a specific status and to generate a localized message.

Returns:

  • the status code.

getDetails(): Map

Returns the optional details for this StatusItem.

Returns:

  • the optional details for this StatusItem.

getMessage(): String

Returns the default human readable message for this Status.

Note: Custom code and client programs must not use this message to identify a specific status. The getCode() must be used for that purpose. The actual message can change from release to release.

Returns:

  • the default human readable message for this Status.

getParameters(): List

Returns the parameters to construct a custom message.

Returns:

  • the parameters to construct a custom message.

getStatus(): Number

Returns the status.

Returns:


isError(): Boolean

Returns whether this Status Item represents and error.

Returns:

  • true is this item represents an error, false otherwise.

setCode(code: String): void

Method to set the status code. The status code is the unique identifier for the message and can be used by client programs to check for a specific status and to generate a localized message.

Parameters:

  • code - the status code.

setMessage(message: String): void

Sets the default human readable message for this Status.

Parameters:

  • message - the default human readable message for this Status.

setParameters(parameters: Object[]): void

Sets the parameters for a custom message.

Parameters:

  • parameters - the parameters for a custom message.

setStatus(status: Number): void

Set the status.

Parameters: