 |
- java.lang.Object
-
- org.springframework.core.ExceptionDepthComparator
-
- All Implemented Interfaces:
- java.util.Comparator<java.lang.Class<? extends java.lang.Throwable>>
public class ExceptionDepthComparator
extends java.lang.Object
implements java.util.Comparator<java.lang.Class<? extends java.lang.Throwable>>
Comparator capable of sorting exceptions based on their depth from the thrown exception type.
- Since:
- 3.0.3
- Author:
- Juergen Hoeller, Arjen Poutsma
-
-
Constructor Summary
Constructors
Constructor and Description |
ExceptionDepthComparator(java.lang.Class<? extends java.lang.Throwable> exceptionType)
Create a new ExceptionDepthComparator for the given exception type.
|
ExceptionDepthComparator(java.lang.Throwable exception)
Create a new ExceptionDepthComparator for the given exception.
|
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods
Modifier and Type |
Method and Description |
int |
compare(java.lang.Class<? extends java.lang.Throwable> o1,
java.lang.Class<? extends java.lang.Throwable> o2) |
static java.lang.Class<? extends java.lang.Throwable> |
findClosestMatch(java.util.Collection<java.lang.Class<? extends java.lang.Throwable>> exceptionTypes,
java.lang.Throwable targetException)
Obtain the closest match from the given exception types for the given target exception.
|
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Comparator
comparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
-
Method Detail
-
findClosestMatch
public static java.lang.Class<? extends java.lang.Throwable> findClosestMatch(java.util.Collection<java.lang.Class<? extends java.lang.Throwable>> exceptionTypes,
java.lang.Throwable targetException)
Obtain the closest match from the given exception types for the given target exception.
- Parameters:
exceptionTypes - the collection of exception types
targetException - the target exception to find a match for
- Returns:
- the closest matching exception type from the given collection
|
|