类 ExceptionHandlerMethodResolver
java.lang.Object
cn.taketoday.web.handler.method.ExceptionHandlerMethodResolver
Discovers @ExceptionHandler methods in a given class,
including all of its superclasses, and helps to resolve a given
Exception
to the exception types supported by a given Method.- 从以下版本开始:
- 4.0 2022/3/2 22:12
- 作者:
- Rossen Stoyanchev, Juergen Hoeller, Sam Brannen, Harry Yang
-
字段概要
字段修饰符和类型字段说明static final cn.taketoday.util.ReflectionUtils.MethodFilterA filter for selecting@ExceptionHandlermethods.private static final Method -
构造器概要
构造器构造器说明ExceptionHandlerMethodResolver(Class<?> handlerType) A constructor that findsExceptionHandlermethods in the given type. -
方法概要
修饰符和类型方法说明private voidaddExceptionMapping(Class<? extends Throwable> exceptionType, Method method) private voiddetectAnnotationExceptionMappings(Method method, List<Class<? extends Throwable>> result) detectExceptionMappings(Method method) Extract exception mappings from the@ExceptionHandlerannotation first, and then as a fallback from the method signature itself.private MethodgetMappedMethod(Class<? extends Throwable> exceptionType) Return theMethodmapped to the given exception type, orNO_MATCHING_EXCEPTION_HANDLER_METHODif none.booleanWhether the contained type has any exception mappings.private voidFor theNO_MATCHING_EXCEPTION_HANDLER_METHODconstant.resolveMethod(Throwable exception) Find aMethodto handle the given exception.resolveMethodByExceptionType(Class<? extends Throwable> exceptionType) Find aMethodto handle the given exception type.resolveMethodByThrowable(Throwable exception) Find aMethodto handle the given Throwable.
-
字段详细资料
-
EXCEPTION_HANDLER_METHODS
public static final cn.taketoday.util.ReflectionUtils.MethodFilter EXCEPTION_HANDLER_METHODSA filter for selecting@ExceptionHandlermethods. -
NO_MATCHING_EXCEPTION_HANDLER_METHOD
-
mappedMethods
-
exceptionLookupCache
-
-
构造器详细资料
-
ExceptionHandlerMethodResolver
A constructor that findsExceptionHandlermethods in the given type.- 参数:
handlerType- the type to introspect
-
-
方法详细资料
-
detectExceptionMappings
Extract exception mappings from the@ExceptionHandlerannotation first, and then as a fallback from the method signature itself. -
detectAnnotationExceptionMappings
-
addExceptionMapping
-
hasExceptionMappings
public boolean hasExceptionMappings()Whether the contained type has any exception mappings. -
resolveMethod
Find aMethodto handle the given exception.Uses
ExceptionDepthComparatorif more than one match is found.- 参数:
exception- the exception- 返回:
- a Method to handle the exception, or
nullif none found
-
resolveMethodByThrowable
Find aMethodto handle the given Throwable.Uses
ExceptionDepthComparatorif more than one match is found.- 参数:
exception- the exception- 返回:
- a Method to handle the exception, or
nullif none found
-
resolveMethodByExceptionType
Find aMethodto handle the given exception type. This can be useful if anExceptioninstance is not available (e.g. for tools).Uses
ExceptionDepthComparatorif more than one match is found.- 参数:
exceptionType- the exception type- 返回:
- a Method to handle the exception, or
nullif none found
-
getMappedMethod
Return theMethodmapped to the given exception type, orNO_MATCHING_EXCEPTION_HANDLER_METHODif none. -
noMatchingExceptionHandler
private void noMatchingExceptionHandler()For theNO_MATCHING_EXCEPTION_HANDLER_METHODconstant.
-