Package org.bremersee.exception
Class ImmutableExceptionMapping.Builder
java.lang.Object
org.bremersee.exception.ImmutableExceptionMapping.Builder
- Enclosing class:
- ImmutableExceptionMapping
Builds instances of type
ImmutableExceptionMapping
.
Initialize attributes and then invoke the build()
method to create an
immutable instance.
Builder
is not thread-safe and generally should not be stored in a field or collection,
but instead used immediately to create instances.
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds a newImmutableExceptionMapping
.Initializes the value for thecode
attribute.exceptionClassName
(String exceptionClassName) Initializes the value for theexceptionClassName
attribute.Fill a builder with attribute values from the providedExceptionMapping
instance.Initializes the value for themessage
attribute.status
(int status) Initializes the value for thestatus
attribute.
-
Method Details
-
from
public final ImmutableExceptionMapping.Builder from(RestApiExceptionMapperProperties.ExceptionMapping instance) Fill a builder with attribute values from the providedExceptionMapping
instance. Regular attribute values will be replaced with those from the given instance. Absent optional values will not replace present values.- Parameters:
instance
- The instance from which to copy values- Returns:
this
builder for use in a chained invocation
-
exceptionClassName
Initializes the value for theexceptionClassName
attribute.- Parameters:
exceptionClassName
- The value for exceptionClassName- Returns:
this
builder for use in a chained invocation
-
status
Initializes the value for thestatus
attribute.If not set, this attribute will have a default value as returned by the initializer of
status
.- Parameters:
status
- The value for status- Returns:
this
builder for use in a chained invocation
-
message
Initializes the value for themessage
attribute.- Parameters:
message
- The value for message (can benull
)- Returns:
this
builder for use in a chained invocation
-
code
Initializes the value for thecode
attribute.- Parameters:
code
- The value for code (can benull
)- Returns:
this
builder for use in a chained invocation
-
build
Builds a newImmutableExceptionMapping
.- Returns:
- An immutable instance of ExceptionMapping
- Throws:
IllegalStateException
- if any required attributes are missing
-