类 InstanceFilter<T>
java.lang.Object
cn.taketoday.util.InstanceFilter<T>
- 类型参数:
T- the instance type
- 直接已知子类:
ExceptionTypeFilter
A simple instance filter that checks if a given instance match based on
a collection of includes and excludes element.
Subclasses may want to override match(Object, Object) to provide
a custom matching algorithm.
- 从以下版本开始:
- 4.0 2022/3/9 20:40
- 作者:
- Stephane Nicoll, Harry Yang
-
字段概要
字段修饰符和类型字段说明private final Collection<? extends T>private final Collection<? extends T>private final boolean -
构造器概要
构造器构造器说明InstanceFilter(Collection<? extends T> includes, Collection<? extends T> excludes, boolean matchIfEmpty) Create a new instance based on includes/excludes collections. -
方法概要
修饰符和类型方法说明booleanDetermine if the specified {code instance} matches this filter.protected booleanmatch(T instance, Collection<? extends T> candidates) Determine if the specifiedinstancematches one of the candidates.protected booleanDetermine if the specifiedinstanceis equal to the specifiedcandidate.toString()
-
字段详细资料
-
includes
-
excludes
-
matchIfEmpty
private final boolean matchIfEmpty
-
-
构造器详细资料
-
InstanceFilter
public InstanceFilter(@Nullable Collection<? extends T> includes, @Nullable Collection<? extends T> excludes, boolean matchIfEmpty) Create a new instance based on includes/excludes collections.A particular element will match if it "matches" the one of the element in the includes list and does not match one of the element in the excludes list.
Subclasses may redefine what matching means. By default, an element match with another if it is equals according to
Object.equals(Object)If both collections are empty,
matchIfEmptydefines if an element matches or not.- 参数:
includes- the collection of includesexcludes- the collection of excludesmatchIfEmpty- the matching result if both the includes and the excludes collections are empty
-
-
方法详细资料
-
match
Determine if the specified {code instance} matches this filter. -
match
Determine if the specifiedinstanceis equal to the specifiedcandidate.- 参数:
instance- the instance to handlecandidate- a candidate defined by this filter- 返回:
trueif the instance matches the candidate
-
match
Determine if the specifiedinstancematches one of the candidates.If the candidates collection is
null, returnsfalse.- 参数:
instance- the instance to checkcandidates- a list of candidates- 返回:
trueif the instance match or the candidates collection is null
-
toString
-