public class ErrorResponseBuilderImpl extends Object implements ErrorResponseBuilder
| Constructor and Description |
|---|
ErrorResponseBuilderImpl() |
| Modifier and Type | Method and Description |
|---|---|
ErrorResponseBuilder |
addContainerMessages(Severity... severities)
Adds the non-leading container messages with the given severities to the
ErrorResponse.
|
ErrorResponseBuilder |
addErrorDetail(String code,
String target,
Object... params)
Adds a new error detail.
|
Throwable |
getCause() |
String |
getMessage() |
int |
getStatuscode() |
ErrorResponse |
response()
Returns an instance of ErrorResponse object.
|
ErrorResponseBuilder |
setCause(Throwable throwable)
Sets the exception that caused the operation to fail in the
ErrorResponseBuilder object.
|
ErrorResponseBuilder |
setErrorCode(String errorCode)
Sets the error code in the ErrorResponseBuilder object.
|
ErrorResponseBuilder |
setMessage(String messageKey,
Object... params)
Sets the error message considering localization.
|
ErrorResponseBuilder |
setStatusCode(int statusCode)
Sets the status code of the error in the ErrorResponseBuilder object.
|
public ErrorResponseBuilder setCause(Throwable throwable)
ErrorResponseBuildersetCause in interface ErrorResponseBuilderthrowable - A Throwable object that represents the exceptionErrorResponseBuilder object containing the
exceptionpublic ErrorResponseBuilder setStatusCode(int statusCode)
ErrorResponseBuildersetStatusCode in interface ErrorResponseBuilderstatusCode - An int representing the status codeErrorResponseBuilder object containing the status
codepublic ErrorResponseBuilder setMessage(String messageKey, Object... params)
ErrorResponseBuildersetMessage in interface ErrorResponseBuildermessageKey - A String key associated with the message in
properties file to retrieve the message text.
In case there is no value for such a key in the property
file, the message key itself will be taken as the message text.
This parameter is set as the error code in the error response
only if the error code is not explicitly set using setErrorCode API.params - Variable length array of objects for this message. These
objects will be converted to strings and substituted in the messageText in place
of parameter placeholders. In case there are no parameters, do not
pass any objects for this argument.ErrorResponseBuilder object containing the
message.public Throwable getCause()
public int getStatuscode()
public String getMessage()
public ErrorResponse response()
ErrorResponseBuilderresponse in interface ErrorResponseBuilderErrorResponse objectpublic ErrorResponseBuilder addContainerMessages(Severity... severities)
ErrorResponseBuilderaddContainerMessages in interface ErrorResponseBuilderseverities - A variable length argument which denotes the severity of the
messages which have to be added from the MessageContainer to
the error response.public ErrorResponseBuilder addErrorDetail(String code, String target, Object... params)
ErrorResponseBuilderaddErrorDetail in interface ErrorResponseBuildercode - associated with the message, used as the key to a properties
file to retrieve the message text.target - Target for which this error detail applies.params - Variable length array of parameters for this message.public ErrorResponseBuilder setErrorCode(String errorCode)
ErrorResponseBuildersetErrorCode in interface ErrorResponseBuildererrorCode - A String representing the error codeErrorResponseBuilder object containing the error
codeCopyright © 2020 SAP. All Rights Reserved.