public class ExceptionHandlerMethodResolver extends Object
ExceptionHandler
methods at initialization, finds
the best matching method mapped to an exception at runtime.
Exception mappings are extracted from the method @ExceptionHandler
annotation or by looking for Throwable
method arguments.
Modifier and Type | Field and Description |
---|---|
static ReflectionUtils.MethodFilter |
EXCEPTION_HANDLER_METHODS
A filter for selecting @
ExceptionHandler methods. |
Constructor and Description |
---|
ExceptionHandlerMethodResolver(Class<?> handlerType)
A constructor that finds
ExceptionHandler methods in a handler. |
public static final ReflectionUtils.MethodFilter EXCEPTION_HANDLER_METHODS
ExceptionHandler
methods.public ExceptionHandlerMethodResolver(Class<?> handlerType)
ExceptionHandler
methods in a handler.handlerType
- the handler to inspect for exception handler methods.IllegalStateException
- If an exception type is mapped to two methods.IllegalArgumentException
- If an @ExceptionHandler
method is not mapped to any exceptions.public Method resolveMethod(Exception exception)
ExceptionDepthComparator
.exception
- the exceptionExceptionHandler
method, or null
Copyright © 2012. All Rights Reserved.