Class ErrorResponseBuilder
- All Implemented Interfaces:
Builder<ErrorResponse>
Example to create an instance using the builder pattern
ErrorResponse errorResponse = ErrorResponse.builder()
.statusCode(1)
.message("{message}")
.build()
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
builds ErrorResponse with checking for non-null required valuesbuilds ErrorResponse without checking for non-null required valueserrors
(ErrorObject... errors) Errors returned for a request.errors
(List<ErrorObject> errors) Errors returned for a request.Errors returned for a request.First error message in theerrors
array.HTTP status code corresponding to the error.First error message in theerrors
array.static ErrorResponseBuilder
of()
factory method for an instance of ErrorResponseBuilderstatic ErrorResponseBuilder
of
(ErrorResponse template) create builder for ErrorResponse instanceplusErrors
(ErrorObject... errors) Errors returned for a request.plusErrors
(Function<ErrorObjectBuilder, Builder<? extends ErrorObject>> builder) Errors returned for a request.statusCode
(Integer statusCode) HTTP status code corresponding to the error.withErrors
(Function<ErrorObjectBuilder, Builder<? extends ErrorObject>> builder) Errors returned for a request.
-
Constructor Details
-
ErrorResponseBuilder
public ErrorResponseBuilder()
-
-
Method Details
-
statusCode
HTTP status code corresponding to the error.
- Parameters:
statusCode
- value to be set- Returns:
- Builder
-
message
First error message in the
errors
array.- Parameters:
message
- value to be set- Returns:
- Builder
-
errors
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
- value to be set- Returns:
- Builder
-
errors
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
- value to be set- Returns:
- Builder
-
plusErrors
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
- value to be set- Returns:
- Builder
-
plusErrors
public ErrorResponseBuilder plusErrors(Function<ErrorObjectBuilder, Builder<? extends ErrorObject>> builder) 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:
builder
- function to build the errors value- Returns:
- Builder
-
withErrors
public ErrorResponseBuilder withErrors(Function<ErrorObjectBuilder, Builder<? extends ErrorObject>> builder) 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:
builder
- function to build the errors value- Returns:
- Builder
-
getStatusCode
HTTP status code corresponding to the error.
- Returns:
- statusCode
-
getMessage
First error message in the
errors
array.- 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
-
build
builds ErrorResponse with checking for non-null required values- Specified by:
build
in interfaceBuilder<ErrorResponse>
- Returns:
- ErrorResponse
-
buildUnchecked
builds ErrorResponse without checking for non-null required values- Returns:
- ErrorResponse
-
of
factory method for an instance of ErrorResponseBuilder- Returns:
- builder
-
of
create builder for ErrorResponse instance- Parameters:
template
- instance with prefilled values for the builder- Returns:
- builder
-