org.springframework.util

## 类 InstanceFilter<T>

- java.lang.Object
- - org.springframework.util.InstanceFilter<T>

- 直接已知子类:
    ExceptionTypeFilter

      public class InstanceFilter<T>
      extends Object

  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.1
  作者:
    Stephane Nicoll

- - ### 构造器概要

    构造器
    构造器和说明
    `InstanceFilter(Collection<? extends T> includes, Collection<? extends T> excludes, boolean matchIfEmpty)` Create a new instance based on includes/excludes collections.

  - ### 方法概要

    所有方法 实例方法 具体方法
    限定符和类型 | 方法和说明
    --- | ---
    `boolean` | `match(T instance)` Determine if the specified {code instance} matches this filter.
    `protected boolean` | `match(T instance, Collection<? extends T> candidates)` Determine if the specified `instance` matches one of the candidates.
    `protected boolean` | `match(T instance, T candidate)` Determine if the specified `instance` is equal to the specified `candidate`.
    `String` | `toString()`

    - ### 从类继承的方法 java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### 构造器详细资料

    - #### 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, `matchIfEmpty` defines if an element matches or not.

      参数:
        `includes` - the collection of includes
        `excludes` - the collection of excludes
        `matchIfEmpty` - the matching result if both the includes and the excludes collections are empty

  - ### 方法详细资料

    - #### match

          public boolean match(T instance)

      Determine if the specified {code instance} matches this filter.

    - #### match

          protected boolean match(T instance,
                                  T candidate)

      Determine if the specified `instance` is equal to the specified `candidate`.
      参数:
        `instance` - the instance to handle
        `candidate` - a candidate defined by this filter
      返回:
        `true` if the instance matches the candidate

    - #### match

          protected boolean match(T instance,
                                  Collection<? extends T> candidates)

      Determine if the specified `instance` matches one of the candidates.

      If the candidates collection is `null`, returns `false`.

      参数:
        `instance` - the instance to check
        `candidates` - a list of candidates
      返回:
        `true` if the instance match or the candidates collection is null

    - #### toString

          public String toString()

      覆盖:
        `toString` 在类中 `Object`