Class ErrorMessageBuilderImpl
java.lang.Object
com.creativityfactory.swiftserver.error.ErrorMessageBuilderImpl
- All Implemented Interfaces:
ErrorMessageBuilder
This class implements the ErrorMessageBuilder
interface and provides a concrete implementation
of building the ErrorResponse
object using the builder pattern.
The builder methods allow setting the timestamp, status code, error message, message, and path fields
of the ErrorResponse object. The reset method allows resetting the builder state to start building
a new ErrorResponse object.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuildError
(String error) Sets the error field of theErrorResponse
to the specified error message.buildMessage
(String message) Sets the message field of theErrorResponse
to the specified message.Sets the path field of theErrorResponse
to the specified path.buildStatusCode
(int code) Sets the status code field of theErrorResponse
to the specified code.buildTimestamp
(Date timestamp) Sets the timestamp field of theErrorResponse
to the specified date.make()
Builds and returns a new instance ofErrorResponse
using the fields set on this builder.reset()
Resets the builder's internal state to its initial values.
-
Constructor Details
-
ErrorMessageBuilderImpl
public ErrorMessageBuilderImpl()
-
-
Method Details
-
buildTimestamp
Description copied from interface:ErrorMessageBuilder
Sets the timestamp field of theErrorResponse
to the specified date.- Specified by:
buildTimestamp
in interfaceErrorMessageBuilder
- Parameters:
timestamp
- the date to set as the timestamp- Returns:
- the builder instance for method chaining
-
buildStatusCode
Description copied from interface:ErrorMessageBuilder
Sets the status code field of theErrorResponse
to the specified code.- Specified by:
buildStatusCode
in interfaceErrorMessageBuilder
- Parameters:
code
- the HTTP status code to set- Returns:
- the builder instance for method chaining
-
buildError
Description copied from interface:ErrorMessageBuilder
Sets the error field of theErrorResponse
to the specified error message.- Specified by:
buildError
in interfaceErrorMessageBuilder
- Parameters:
error
- the error message to set- Returns:
- the builder instance for method chaining
-
buildMessage
Description copied from interface:ErrorMessageBuilder
Sets the message field of theErrorResponse
to the specified message.- Specified by:
buildMessage
in interfaceErrorMessageBuilder
- Parameters:
message
- the message to set- Returns:
- the builder instance for method chaining
-
buildPath
Description copied from interface:ErrorMessageBuilder
Sets the path field of theErrorResponse
to the specified path.- Specified by:
buildPath
in interfaceErrorMessageBuilder
- Parameters:
path
- the path to set- Returns:
- the builder instance for method chaining
-
reset
Description copied from interface:ErrorMessageBuilder
Resets the builder's internal state to its initial values.- Specified by:
reset
in interfaceErrorMessageBuilder
- Returns:
- the builder instance for method chaining
-
make
Description copied from interface:ErrorMessageBuilder
Builds and returns a new instance ofErrorResponse
using the fields set on this builder.- Specified by:
make
in interfaceErrorMessageBuilder
- Returns:
- a new instance of
ErrorResponse
-