类 ExceptionDepthComparator
java.lang.Object
cn.taketoday.util.comparator.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.
- 从以下版本开始:
- 4.0
- 作者:
- 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. -
方法概要
修饰符和类型方法说明intfindClosestMatch(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
Create a new ExceptionDepthComparator for the given exception.- 参数:
exception- the target exception to compare to when sorting by depth
-
ExceptionDepthComparator
Create a new ExceptionDepthComparator for the given exception type.- 参数:
exceptionType- the target exception type to compare to when sorting by depth
-
-
方法详细资料
-
compare
- 指定者:
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
-