类 AbstractExceptionHandlerMethodResolver
- java.lang.Object
- org.springframework.messaging.handler.invocation.AbstractExceptionHandlerMethodResolver
public abstract class AbstractExceptionHandlerMethodResolver extends Object
Cache exception handling method mappings and provide options to look up a method that should handle an exception. If multiple methods match, they are sorted usingExceptionDepthComparatorand the top match is returned.- 从以下版本开始:
- 4.0
- 作者:
- Rossen Stoyanchev, Juergen Hoeller
构造器概要
构造器 限定符 构造器 说明 protectedAbstractExceptionHandlerMethodResolver(Map<Class<? extends Throwable>,Method> mappedMethods)Protected constructor accepting exception-to-method mappings.
方法概要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 说明 protected static List<Class<? extends Throwable>>getExceptionsFromMethodSignature(Method method)Extract the exceptions this method handles.This implementation looks for sub-classes of Throwable in the method signature.booleanhasExceptionMappings()Whether the contained type has any exception mappings.MethodresolveMethod(Exception exception)Find aMethodto handle the given exception.MethodresolveMethodByExceptionType(Class<? extends Throwable> exceptionType)Find aMethodto handle the given exception type.
构造器详细资料
AbstractExceptionHandlerMethodResolver
protected AbstractExceptionHandlerMethodResolver(Map<Class<? extends Throwable>,Method> mappedMethods)
Protected constructor accepting exception-to-method mappings.
方法详细资料
getExceptionsFromMethodSignature
protected static List<Class<? extends Throwable>> getExceptionsFromMethodSignature(Method method)
Extract the exceptions this method handles.This implementation looks for sub-classes of Throwable in the method signature. The method is static to ensure safe use from sub-class constructors.
hasExceptionMappings
public boolean hasExceptionMappings()
Whether the contained type has any exception mappings.
resolveMethod
public Method resolveMethod(Exception exception)
Find aMethodto handle the given exception. UseExceptionDepthComparatorif more than one match is found.- 参数:
exception- the exception- 返回:
- a Method to handle the exception, or
nullif none found
resolveMethodByExceptionType
public Method resolveMethodByExceptionType(Class<? extends Throwable> exceptionType)
Find aMethodto handle the given exception type. This can be useful if anExceptioninstance is not available (e.g. for tools).- 参数:
exceptionType- the exception type- 返回:
- a Method to handle the exception, or
nullif none found - 从以下版本开始:
- 4.3.1