Class ExceptionTypeFilter

java.lang.Object
org.springframework.util.InstanceFilter<Class<? extends Throwable>>
org.springframework.util.ExceptionTypeFilter

public class ExceptionTypeFilter extends InstanceFilter<Class<? extends Throwable>>
An InstanceFilter that handles exception types.

An exception type will match against a given candidate if it is assignable to that candidate.

Since:
4.1
Author:
Stephane Nicoll, Sam Brannen
  • Constructor Details

  • Method Details

    • match

      public boolean match(Throwable exception)
      Determine if the type of the supplied exception matches this filter.
      Parameters:
      exception - the exception to match against
      Returns:
      true if this filter matches the supplied exception
      Since:
      7.0
      See Also:
    • match

      public boolean match(Throwable exception, boolean traverseCauses)
      Determine if the type of the supplied exception matches this filter, potentially matching against nested causes.
      Parameters:
      exception - the exception to match against
      traverseCauses - whether the matching algorithm should recursively match against nested causes of the exception
      Returns:
      true if this filter matches the supplied exception or one of its nested causes
      Since:
      7.0
      See Also:
    • match

      protected boolean match(Class<? extends Throwable> instance, Class<? extends Throwable> candidate)
      Determine if the specified instance matches the specified candidate.

      By default, the two instances match if the candidate type is is assignable from the instance type.

      Can be overridden by subclasses.

      Overrides:
      match in class InstanceFilter<Class<? extends Throwable>>
      Parameters:
      instance - the instance to check
      candidate - a candidate defined by this filter
      Returns:
      true if the instance matches the candidate