Class ExceptionHandlerRegistration<C,T extends Throwable>
java.lang.Object
org.incendo.cloud.exception.handling.ExceptionHandlerRegistration<C,T>
- Type Parameters:
C- the command sender typeT- the exception type
@API(status=STABLE)
public final class ExceptionHandlerRegistration<C,T extends Throwable>
extends Object
Used to register a
ExceptionHandler in the ExceptionController.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic final class -
Method Summary
Modifier and TypeMethodDescriptionstatic <C,T extends Throwable>
@NonNull ExceptionHandlerRegistration.ExceptionControllerBuilder<C, T> Returns a builder.Returns the exception filter.@NonNull ExceptionHandler<C, ? extends T> Returns the exception handler.Returns the exception type handler by this handler.static <C,T extends Throwable>
@NonNull ExceptionHandlerRegistration<C, ? extends T> of(@NonNull TypeToken<T> exceptionType, @NonNull ExceptionHandler<C, ? extends T> exceptionHandler) Returns a new registration.
-
Method Details
-
of
public static <C,T extends Throwable> @NonNull ExceptionHandlerRegistration<C,? extends T> of(@NonNull TypeToken<T> exceptionType, @NonNull ExceptionHandler<C, ? extends T> exceptionHandler) Returns a new registration.- Type Parameters:
C- the command sender typeT- the exception type- Parameters:
exceptionType- the type handled by the exception handlerexceptionHandler- the exception handler- Returns:
- the created registration
-
builder
public static <C,T extends Throwable> @NonNull ExceptionHandlerRegistration.ExceptionControllerBuilder<C,T> builder(@NonNull TypeToken<T> exceptionType) Returns a builder.The builder is immutable, and each method results in a new builder instance.
- Type Parameters:
C- the command sender typeT- the exception type- Parameters:
exceptionType- the type handled by the exception handler- Returns:
- the builder
-
exceptionType
Returns the exception type handler by this handler.More precise exception types will always get higher priority when selecting the exception handlers for any given exception.
- Returns:
- the exception type
-
exceptionHandler
Returns the exception handler.- Returns:
- the exception handler
-
exceptionFilter
Returns the exception filter.Exceptions should only be handled by the
exceptionHandler()if the predicate evaluates totrue.- Returns:
- the exception filter
-