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
-
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.Methods inherited from class org.springframework.util.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.- 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
-