public abstract class AbstractExceptionHandlerMethodResolver extends Object
ExceptionDepthComparator
and the top match is returned.Modifier | Constructor and Description |
---|---|
protected |
AbstractExceptionHandlerMethodResolver(Map<Class<? extends Throwable>,Method> mappedMethods)
Protected constructor accepting exception-to-method mappings.
|
Modifier and Type | Method and Description |
---|---|
protected static List<Class<? extends Throwable>> |
getExceptionsFromMethodSignature(Method method)
Extract the exceptions this method handles.
|
boolean |
hasExceptionMappings()
Whether the contained type has any exception mappings.
|
Method |
resolveMethod(Throwable exception)
Find a
Method to handle the given exception. |
Method |
resolveMethodByExceptionType(Class<? extends Throwable> exceptionType)
Find a
Method to handle the given exception type. |
protected static List<Class<? extends Throwable>> getExceptionsFromMethodSignature(Method method)
The method is static to ensure safe use from subclass constructors.
public boolean hasExceptionMappings()
@Nullable public Method resolveMethod(Throwable exception)
Method
to handle the given exception.
Uses ExceptionDepthComparator
if more than one match is found.
exception
- the exceptionnull
if none found@Nullable public Method resolveMethodByExceptionType(Class<? extends Throwable> exceptionType)
Method
to handle the given exception type. This can be
useful if an Exception
instance is not available (e.g. for tools).
Uses ExceptionDepthComparator
if more than one match is found.
exceptionType
- the exception typenull
if none found