Package org.chenile.base.response
Class ResponseMessage
java.lang.Object
org.chenile.base.response.ResponseMessage
A detailed response message that contains a bunch of information.
Code - HTTP Status code
subErrorCode - The specific error returned by the service. Typically, there must be
an enum that the service defines which has all the possible values for the subErrorCode
that the particular service returns. Sub error codes are mapped to an i18n message that can
have substitutable parameters.
Description - of the error. Must be internationalized and must be found in a message bundle
Field - at which the error occurred. This is useful if there is a validation failure for a particular field
Severity - which can have the value WARN or ERROR
Params - which contain replacements for the substitutable parameters contained in the i18n message
-
Field Summary
Modifier and TypeFieldDescriptionprivate HttpStatus
The HTTP Status Code - default to internal server errorprivate String
A message.private String
private Object[]
Params that might be needed to render the description.private ErrorType
private int
The error code specific to the service -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionclone()
int
getCode()
getField()
Object[]
int
void
setCode
(int code) void
setCode
(HttpStatus code) void
setDescription
(String message) void
void
void
setSeverity
(ErrorType severity) void
setSubErrorCode
(int subErrorCode) toString()
-
Field Details
-
field
-
description
A message. Can be a translated message after applying i18n -
code
The HTTP Status Code - default to internal server error -
subErrorCode
private int subErrorCodeThe error code specific to the service -
params
Params that might be needed to render the description. These contain substitutable parameters Ex: Resource {0} not found -
severity
-
-
Constructor Details
-
ResponseMessage
public ResponseMessage()
-
-
Method Details
-
getDescription
-
setDescription
-
getCode
public int getCode() -
setCode
public void setCode(int code) -
setCode
-
getParams
-
setParams
-
getSeverity
-
setSeverity
-
toString
-
getField
-
setField
-
getSubErrorCode
public int getSubErrorCode() -
setSubErrorCode
public void setSubErrorCode(int subErrorCode) -
clone
-