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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuildError(String error) Sets the error field of theErrorResponseto the specified error message.buildMessage(String message) Sets the message field of theErrorResponseto the specified message.Sets the path field of theErrorResponseto the specified path.buildStatusCode(int code) Sets the status code field of theErrorResponseto the specified code.buildTimestamp(Date timestamp) Sets the timestamp field of theErrorResponseto the specified date.make()Builds and returns a new instance ofErrorResponseusing 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:ErrorMessageBuilderSets the timestamp field of theErrorResponseto the specified date.- Specified by:
buildTimestampin interfaceErrorMessageBuilder- Parameters:
timestamp- the date to set as the timestamp- Returns:
- the builder instance for method chaining
-
buildStatusCode
Description copied from interface:ErrorMessageBuilderSets the status code field of theErrorResponseto the specified code.- Specified by:
buildStatusCodein interfaceErrorMessageBuilder- Parameters:
code- the HTTP status code to set- Returns:
- the builder instance for method chaining
-
buildError
Description copied from interface:ErrorMessageBuilderSets the error field of theErrorResponseto the specified error message.- Specified by:
buildErrorin interfaceErrorMessageBuilder- Parameters:
error- the error message to set- Returns:
- the builder instance for method chaining
-
buildMessage
Description copied from interface:ErrorMessageBuilderSets the message field of theErrorResponseto the specified message.- Specified by:
buildMessagein interfaceErrorMessageBuilder- Parameters:
message- the message to set- Returns:
- the builder instance for method chaining
-
buildPath
Description copied from interface:ErrorMessageBuilderSets the path field of theErrorResponseto the specified path.- Specified by:
buildPathin interfaceErrorMessageBuilder- Parameters:
path- the path to set- Returns:
- the builder instance for method chaining
-
reset
Description copied from interface:ErrorMessageBuilderResets the builder's internal state to its initial values.- Specified by:
resetin interfaceErrorMessageBuilder- Returns:
- the builder instance for method chaining
-
make
Description copied from interface:ErrorMessageBuilderBuilds and returns a new instance ofErrorResponseusing the fields set on this builder.- Specified by:
makein interfaceErrorMessageBuilder- Returns:
- a new instance of
ErrorResponse
-