## org.springframework.context.event
Class SourceFilteringListener

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

All Implemented Interfaces:
  EventListener, ApplicationListener

    public class SourceFilteringListener

extends Object
implements ApplicationListener

`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.

Since:
  2.0.5
Author:
  Juergen Hoeller

Constructor Summary
`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.

Method Summary
`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.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### SourceFilteringListener

    public SourceFilteringListener(Object source,
                                   ApplicationListener delegate)

  Create a SourceFilteringListener for the given event source.

  Parameters:
    `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).

  Parameters:
    `source` - the event source that this listener filters for, only processing events from this source

Method Detail

### onApplicationEvent

    public void onApplicationEvent(ApplicationEvent event)

  Description copied from interface: `ApplicationListener`
  Handle an application event.

  Specified by:
    `onApplicationEvent` in interface `ApplicationListener`
  Parameters:
    `event` - the event to respond to

### 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.

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

Copyright © 2002-2008 The Spring Framework.