public class ExceptionHandlerMethodResolver
extends java.lang.Object
Exception
to the exception types supported by a given Method.| Modifier and Type | Field and Description |
|---|---|
static ReflectionUtils.MethodFilter |
EXCEPTION_HANDLER_METHODS
A filter for selecting
@ExceptionHandler methods. |
| Constructor and Description |
|---|
ExceptionHandlerMethodResolver(java.lang.Class<?> handlerType)
A constructor that finds
ExceptionHandler methods in the given type. |
| Modifier and Type | Method and Description |
|---|---|
protected void |
detectAnnotationExceptionMappings(java.lang.reflect.Method method,
java.util.List<java.lang.Class<? extends java.lang.Throwable>> result) |
boolean |
hasExceptionMappings()
Whether the contained type has any exception mappings.
|
java.lang.reflect.Method |
resolveMethod(java.lang.Exception exception)
Find a
Method to handle the given exception. |
java.lang.reflect.Method |
resolveMethodByExceptionType(java.lang.Class<? extends java.lang.Throwable> exceptionType)
Find a
Method to handle the given exception type. |
java.lang.reflect.Method |
resolveMethodByThrowable(java.lang.Throwable exception)
Find a
Method to handle the given Throwable. |
public static final ReflectionUtils.MethodFilter EXCEPTION_HANDLER_METHODS
@ExceptionHandler methods.public ExceptionHandlerMethodResolver(java.lang.Class<?> handlerType)
ExceptionHandler methods in the given type.handlerType - the type to introspectprotected void detectAnnotationExceptionMappings(java.lang.reflect.Method method,
java.util.List<java.lang.Class<? extends java.lang.Throwable>> result)
public boolean hasExceptionMappings()
@Nullable public java.lang.reflect.Method resolveMethod(java.lang.Exception exception)
Method to handle the given exception.
Use ExceptionDepthComparator if more than one match is found.exception - the exceptionnull if none found@Nullable public java.lang.reflect.Method resolveMethodByThrowable(java.lang.Throwable exception)
Method to handle the given Throwable.
Use ExceptionDepthComparator if more than one match is found.exception - the exceptionnull if none found@Nullable public java.lang.reflect.Method resolveMethodByExceptionType(java.lang.Class<? extends java.lang.Throwable> exceptionType)
Method to handle the given exception type. This can be
useful if an Exception instance is not available (e.g. for tools).exceptionType - the exception typenull if none found