public class ExceptionDepthComparator
extends java.lang.Object
implements java.util.Comparator<java.lang.Class<? extends java.lang.Throwable>>
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.
|
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.
|
public ExceptionDepthComparator(java.lang.Throwable exception)
exception
- the target exception to compare to when sorting by depthpublic ExceptionDepthComparator(java.lang.Class<? extends java.lang.Throwable> exceptionType)
exceptionType
- the target exception type to compare to when sorting by depthpublic int compare(java.lang.Class<? extends java.lang.Throwable> o1, java.lang.Class<? extends java.lang.Throwable> o2)
compare
in interface java.util.Comparator<java.lang.Class<? extends java.lang.Throwable>>
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)
exceptionTypes
- the collection of exception typestargetException
- the target exception to find a match for