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 thecodeattribute.exceptionClassName(String exceptionClassName) Initializes the value for theexceptionClassNameattribute.Fill a builder with attribute values from the providedExceptionMappinginstance.Initializes the value for themessageattribute.status(int status) Initializes the value for thestatusattribute.
-
Method Details
-
from
public final ImmutableExceptionMapping.Builder from(RestApiExceptionMapperProperties.ExceptionMapping instance) Fill a builder with attribute values from the providedExceptionMappinginstance. 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:
thisbuilder for use in a chained invocation
-
exceptionClassName
Initializes the value for theexceptionClassNameattribute.- Parameters:
exceptionClassName- The value for exceptionClassName- Returns:
thisbuilder for use in a chained invocation
-
status
Initializes the value for thestatusattribute.If not set, this attribute will have a default value as returned by the initializer of
status.- Parameters:
status- The value for status- Returns:
thisbuilder for use in a chained invocation
-
message
Initializes the value for themessageattribute.- Parameters:
message- The value for message (can benull)- Returns:
thisbuilder for use in a chained invocation
-
code
Initializes the value for thecodeattribute.- Parameters:
code- The value for code (can benull)- Returns:
thisbuilder for use in a chained invocation
-
build
Builds a newImmutableExceptionMapping.- Returns:
- An immutable instance of ExceptionMapping
- Throws:
IllegalStateException- if any required attributes are missing
-