类 ExceptionDepthComparator
- java.lang.Object
- org.springframework.core.ExceptionDepthComparator
- 所有已实现的接口:
Comparator<Class<? extends Throwable>>
public class ExceptionDepthComparator extends Object implements Comparator<Class<? extends Throwable>>
Comparator capable of sorting exceptions based on their depth from the thrown exception type.- 从以下版本开始:
- 3.0.3
- 作者:
- Juergen Hoeller, Arjen Poutsma
构造器概要
构造器 构造器 说明 ExceptionDepthComparator(Class<? extends Throwable> exceptionType)
Create a new ExceptionDepthComparator for the given exception type.ExceptionDepthComparator(Throwable exception)
Create a new ExceptionDepthComparator for the given exception.
方法概要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 说明 int
compare(Class<? extends Throwable> o1, Class<? extends Throwable> o2)
static Class<? extends Throwable>
findClosestMatch(Collection<Class<? extends Throwable>> exceptionTypes, Throwable targetException)
Obtain the closest match from the given exception types for the given target exception.从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
从接口继承的方法 java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
构造器详细资料
ExceptionDepthComparator
public ExceptionDepthComparator(Throwable exception)
Create a new ExceptionDepthComparator for the given exception.- 参数:
exception
- the target exception to compare to when sorting by depth
ExceptionDepthComparator
public ExceptionDepthComparator(Class<? extends Throwable> exceptionType)
Create a new ExceptionDepthComparator for the given exception type.- 参数:
exceptionType
- the target exception type to compare to when sorting by depth
方法详细资料
compare
public int compare(Class<? extends Throwable> o1, Class<? extends Throwable> o2)
- 指定者:
compare
在接口中Comparator<Class<? extends Throwable>>
findClosestMatch
public static Class<? extends Throwable> findClosestMatch(Collection<Class<? extends Throwable>> exceptionTypes, Throwable targetException)
Obtain the closest match from the given exception types for the given target exception.- 参数:
exceptionTypes
- the collection of exception typestargetException
- the target exception to find a match for- 返回:
- the closest matching exception type from the given collection