@Exported public class ServiceResponse extends BaseBean
This class encapsulates a response value object populated by the services.
The response may arise out of a successful transaction, a warning or error. It can associate an end-user message to describe the response, a severity, and an error code to classify the transaction.| Modifier and Type | Class and Description |
|---|---|
static class |
ServiceResponse.Severity
This class enumerates severities of conditions handled in the service
modules.
|
static class |
ServiceResponse.Status
An enumeration of possible states which a response can have.
|
| Constructor and Description |
|---|
ServiceResponse()
Default constructor.
|
ServiceResponse(ServiceResponse.Severity severity)
Overloaded constructor with a standard severity.
|
ServiceResponse(String severity)
Overloaded constructor with a free-form severity.
|
| Modifier and Type | Method and Description |
|---|---|
List<String> |
getMessages()
Returns a list of descriptive messages returned from the service.
|
void |
setSeverity(ServiceResponse.Severity severity)
Sets the severity of this response from one of the standard values
specified.
|
void |
setSeverity(String severity)
Sets the severity of this response.
|
void |
setStatus(Integer status)
Sets a custom status code to be associated with this response.
|
void |
setStatus(ServiceResponse.Status status)
Sets a status code to be associated with this response from one of the
standard values specified.
|
String |
severity()
Returns the severity of this response, as an upper case string, otherwise
returns null.
|
Integer |
status()
Returns the status code, if any, associated with this response.
|
public ServiceResponse()
Default constructor.
Creates an empty service response object with severityServiceResponse.Severity.INFO.public ServiceResponse(ServiceResponse.Severity severity)
Overloaded constructor with a standard severity.
Creates an empty service response object with the specified severity. For free-form values,ServiceResponse.ServiceResponse(String) may be used.severity - The severity for this response object.public ServiceResponse(String severity)
Overloaded constructor with a free-form severity.
Creates an empty service response object with the specified free-form severity. For enumerated values,ServiceResponse.ServiceResponse(Severity) may
be used.severity - The severity for this response object.public List<String> getMessages()
public void setSeverity(String severity)
ServiceResponse.setSeverity(Severity) may be
used.severity - Severity of this response.ServiceResponse.Severitypublic void setSeverity(ServiceResponse.Severity severity)
ServiceResponse.setSeverity(String) may be used.severity - Severity of this response.ServiceResponse.Severitypublic String severity()
public Integer status()
public void setStatus(Integer status)
Sets a custom status code to be associated with this response.
For enumerated values,ServiceResponse.setStatus(Status) may be used.status - - Status to be associated with this response.public void setStatus(ServiceResponse.Status status)
Sets a status code to be associated with this response from one of the standard values specified.
For custom values,ServiceResponse.setStatus(Integer) may be used.status - - Status to be associated with this response.