org.springframework.context.event

## 类 SourceFilteringListener

- java.lang.Object
- - org.springframework.context.event.SourceFilteringListener

- 所有已实现的接口:
    EventListener, ApplicationListener<ApplicationEvent>, GenericApplicationListener, SmartApplicationListener, org.springframework.core.Ordered

      public class SourceFilteringListener
      extends Object
      implements GenericApplicationListener, SmartApplicationListener

  `ApplicationListener` decorator that filters events from a specified event source, invoking its delegate listener for matching `ApplicationEvent` objects only.

  Can also be used as base class, overriding the `onApplicationEventInternal(org.springframework.context.ApplicationEvent)` method instead of specifying a delegate listener.

  从以下版本开始:
    2.0.5
  作者:
    Juergen Hoeller, Stephane Nicoll

- - ### 字段概要

    - ### 从接口继承的字段 org.springframework.core.Ordered

      `HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE`

  - ### 构造器概要

    构造器
    限定符 | 构造器和说明
    --- | ---
    `protected` | `SourceFilteringListener(Object source)` Create a SourceFilteringListener for the given event source, expecting subclasses to override the `onApplicationEventInternal(org.springframework.context.ApplicationEvent)` method (instead of specifying a delegate listener).
    `` | `SourceFilteringListener(Object source, ApplicationListener<?> delegate)` Create a SourceFilteringListener for the given event source.

  - ### 方法概要

    所有方法 实例方法 具体方法
    限定符和类型 | 方法和说明
    --- | ---
    `int` | `getOrder()`
    `void` | `onApplicationEvent(ApplicationEvent event)` Handle an application event.
    `protected void` | `onApplicationEventInternal(ApplicationEvent event)` Actually process the event, after having filtered according to the desired event source already.
    `boolean` | `supportsEventType(Class<? extends ApplicationEvent> eventType)` Determine whether this listener actually supports the given event type.
    `boolean` | `supportsEventType(org.springframework.core.ResolvableType eventType)` Determine whether this listener actually supports the given event type.
    `boolean` | `supportsSourceType(Class<?> sourceType)` Determine whether this listener actually supports the given source type.

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

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

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

    - #### SourceFilteringListener

          public SourceFilteringListener(Object source,
                                         ApplicationListener<?> delegate)

      Create a SourceFilteringListener for the given event source.
      参数:
        `source` - the event source that this listener filters for, only processing events from this source
        `delegate` - the delegate listener to invoke with event from the specified source

    - #### SourceFilteringListener

          protected SourceFilteringListener(Object source)

      Create a SourceFilteringListener for the given event source, expecting subclasses to override the `onApplicationEventInternal(org.springframework.context.ApplicationEvent)` method (instead of specifying a delegate listener).
      参数:
        `source` - the event source that this listener filters for, only processing events from this source

  - ### 方法详细资料

    - #### onApplicationEvent

          public void onApplicationEvent(ApplicationEvent event)

      从接口复制的说明: `ApplicationListener`
      Handle an application event.
      指定者:
        `onApplicationEvent` 在接口中 `ApplicationListener<ApplicationEvent>`
      参数:
        `event` - the event to respond to

    - #### supportsEventType

          public boolean supportsEventType(org.springframework.core.ResolvableType eventType)

      从接口复制的说明: `GenericApplicationListener`
      Determine whether this listener actually supports the given event type.
      指定者:
        `supportsEventType` 在接口中 `GenericApplicationListener`
      参数:
        `eventType` - the event type (never `null`)

    - #### supportsEventType

          public boolean supportsEventType(Class<? extends ApplicationEvent> eventType)

      从接口复制的说明: `SmartApplicationListener`
      Determine whether this listener actually supports the given event type.
      指定者:
        `supportsEventType` 在接口中 `SmartApplicationListener`
      参数:
        `eventType` - the event type (never `null`)

    - #### supportsSourceType

          public boolean supportsSourceType(@Nullable
                                            Class<?> sourceType)

      从接口复制的说明: `GenericApplicationListener`
      Determine whether this listener actually supports the given source type.
      指定者:
        `supportsSourceType` 在接口中 `GenericApplicationListener`
      指定者:
        `supportsSourceType` 在接口中 `SmartApplicationListener`
      参数:
        `sourceType` - the source type, or `null` if no source

    - #### getOrder

          public int getOrder()

      指定者:
        `getOrder` 在接口中 `org.springframework.core.Ordered`

    - #### onApplicationEventInternal

          protected void onApplicationEventInternal(ApplicationEvent event)

      Actually process the event, after having filtered according to the desired event source already.

      The default implementation invokes the specified delegate, if any.

      参数:
        `event` - the event to process (matching the specified source)