public class

ExceptionDepthComparator

extends Object
implements Comparator<T>
java.lang.Object
   ↳ org.springframework.core.ExceptionDepthComparator

Class Overview

Comparator capable of sorting exceptions based on their depth from the thrown exception type.

Summary

Public Constructors
ExceptionDepthComparator(Throwable exception)
Create a new ExceptionDepthComparator for the given exception.
ExceptionDepthComparator(Class<? extends Throwable> exceptionType)
Create a new ExceptionDepthComparator for the given exception type.
Public Methods
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.
[Expand]
Inherited Methods
From class java.lang.Object
From interface java.util.Comparator

Public Constructors

public ExceptionDepthComparator (Throwable exception)

Also: SpringCore

Create a new ExceptionDepthComparator for the given exception.

Parameters
exception the target exception to compare to when sorting by depth

public ExceptionDepthComparator (Class<? extends Throwable> exceptionType)

Also: SpringCore

Create a new ExceptionDepthComparator for the given exception type.

Parameters
exceptionType the target exception type to compare to when sorting by depth

Public Methods

public int compare (Class<? extends Throwable> o1, Class<? extends Throwable> o2)

Also: SpringCore

public static Class<? extends Throwable> findClosestMatch (Collection<Class<? extends Throwable>> exceptionTypes, Throwable targetException)

Also: SpringCore

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