Interface ErrorResponse
- All Known Subinterfaces:
AuthErrorResponse,ProductSearchErrorResponse
public interface ErrorResponse
Base representation of an error response containing common fields to all errors.
Example to create an instance using the builder pattern
ErrorResponse errorResponse = ErrorResponse.builder()
.statusCode(1)
.message("{message}")
.build()
-
Method Summary
Modifier and TypeMethodDescriptionstatic ErrorResponseBuilderbuilder()builder factory method for ErrorResponsestatic ErrorResponseBuilderbuilder(ErrorResponse template) create builder for ErrorResponse instancecopyDeep()static ErrorResponsedeepCopy(ErrorResponse template) factory method to create a deep copy of ErrorResponse@Valid List<ErrorObject>Errors returned for a request.@NotNull StringFirst error message in theerrorsarray.@NotNull IntegerHTTP status code corresponding to the error.static ErrorResponseof()factory methodstatic ErrorResponseof(ErrorResponse template) factory method to create a shallow copy ErrorResponsevoidsetErrors(ErrorObject... errors) Errors returned for a request.voidsetErrors(List<ErrorObject> errors) Errors returned for a request.voidsetMessage(String message) First error message in theerrorsarray.voidsetStatusCode(Integer statusCode) HTTP status code corresponding to the error.static com.fasterxml.jackson.core.type.TypeReference<ErrorResponse>gives a TypeReference for usage with Jackson DataBinddefault <T> TwithErrorResponse(Function<ErrorResponse, T> helper) accessor map function
-
Method Details
-
getStatusCode
HTTP status code corresponding to the error.
- Returns:
- statusCode
-
getMessage
First error message in the
errorsarray.- Returns:
- message
-
getErrors
Errors returned for a request.
A single error response can contain multiple errors if the errors are related to the same HTTP status code such as
400.- Returns:
- errors
-
setStatusCode
HTTP status code corresponding to the error.
- Parameters:
statusCode- value to be set
-
setMessage
First error message in the
errorsarray.- Parameters:
message- value to be set
-
setErrors
Errors returned for a request.
A single error response can contain multiple errors if the errors are related to the same HTTP status code such as
400.- Parameters:
errors- values to be set
-
setErrors
Errors returned for a request.
A single error response can contain multiple errors if the errors are related to the same HTTP status code such as
400.- Parameters:
errors- values to be set
-
of
factory method- Returns:
- instance of ErrorResponse
-
of
factory method to create a shallow copy ErrorResponse- Parameters:
template- instance to be copied- Returns:
- copy instance
-
copyDeep
ErrorResponse copyDeep() -
deepCopy
factory method to create a deep copy of ErrorResponse- Parameters:
template- instance to be copied- Returns:
- copy instance
-
builder
builder factory method for ErrorResponse- Returns:
- builder
-
builder
create builder for ErrorResponse instance- Parameters:
template- instance with prefilled values for the builder- Returns:
- builder
-
withErrorResponse
accessor map function- Type Parameters:
T- mapped type- Parameters:
helper- function to map the object- Returns:
- mapped value
-
typeReference
gives a TypeReference for usage with Jackson DataBind- Returns:
- TypeReference
-