Class ExceptionTypeFilter
java.lang.Object
org.springframework.util.InstanceFilter<Class<? extends Throwable>>
org.springframework.util.ExceptionTypeFilter
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
-
Field Summary
Fields inherited from class InstanceFilter
excludes, includes, matchIfEmpty -
Constructor Summary
ConstructorsConstructorDescriptionExceptionTypeFilter(@Nullable Collection<? extends Class<? extends Throwable>> includes, @Nullable Collection<? extends Class<? extends Throwable>> excludes, boolean matchIfEmpty) Create a newExceptionTypeFilterbased on include and exclude collections.ExceptionTypeFilter(@Nullable Collection<Class<? extends Throwable>> includes, @Nullable Collection<Class<? extends Throwable>> excludes) Create a newExceptionTypeFilterbased on include and exclude collections, with thematchIfEmptyflag set totrue. -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanDetermine if the specifiedinstancematches the specifiedcandidate.booleanDetermine if the type of the suppliedexceptionmatches this filter.booleanDetermine if the type of the suppliedexceptionmatches this filter, potentially matching against nested causes.Methods inherited from class InstanceFilter
match, match, toString
-
Constructor Details
-
ExceptionTypeFilter
public ExceptionTypeFilter(@Nullable Collection<Class<? extends Throwable>> includes, @Nullable Collection<Class<? extends Throwable>> excludes) Create a newExceptionTypeFilterbased on include and exclude collections, with thematchIfEmptyflag set totrue.See
ExceptionTypeFilter(Collection, Collection, boolean)for details.- Parameters:
includes- the collection of includesexcludes- the collection of excludes- Since:
- 7.0
-
ExceptionTypeFilter
public ExceptionTypeFilter(@Nullable Collection<? extends Class<? extends Throwable>> includes, @Nullable Collection<? extends Class<? extends Throwable>> excludes, boolean matchIfEmpty) Create a newExceptionTypeFilterbased on include and exclude collections.See
InstanceFilterfor details.- Parameters:
includes- the collection of includesexcludes- the collection of excludesmatchIfEmpty- the matching result if the includes and the excludes collections are bothnullor empty
-
-
Method Details
-
match
Determine if the type of the suppliedexceptionmatches this filter.- Parameters:
exception- the exception to match against- Returns:
trueif this filter matches the supplied exception- Since:
- 7.0
- See Also:
-
match
Determine if the type of the suppliedexceptionmatches this filter, potentially matching against nested causes.- Parameters:
exception- the exception to match againsttraverseCauses- whether the matching algorithm should recursively match against nested causes of the exception- Returns:
trueif this filter matches the supplied exception or one of its nested causes- Since:
- 7.0
- See Also:
-
match
Determine if the specifiedinstancematches the specifiedcandidate.By default, the two instances match if the
candidatetype is is assignable from theinstancetype.Can be overridden by subclasses.
- Overrides:
matchin classInstanceFilter<Class<? extends Throwable>>- Parameters:
instance- the instance to checkcandidate- a candidate defined by this filter- Returns:
trueif the instance matches the candidate
-