public class ExceptionDepthComparator extends Object implements Comparator<Class<? extends Throwable>>
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
equals
public ExceptionDepthComparator(Throwable exception)
exception
- the target exception to compare to when sorting by depthpublic int compare(Class<? extends Throwable> o1, Class<? extends Throwable> o2)
compare
in interface Comparator<Class<? extends Throwable>>
public static Class<? extends Throwable> findClosestMatch(Collection<Class<? extends Throwable>> exceptionTypes, Throwable targetException)
exceptionTypes
- the collection of exception typestargetException
- the target exception to find a match for