Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.springframework.context.event
Class SourceFilteringListener

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

All Implemented Interfaces:
  EventListener, ApplicationListener<ApplicationEvent>, SmartApplicationListener, Ordered

    public class SourceFilteringListener

extends Object
implements 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.

Since:
  2.0.5
Author:
  Juergen Hoeller

Field Summary

Fields inherited from interface org.springframework.core.Ordered
`HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE`

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
`int` | `getOrder()` Return the order value of this object, with a higher value meaning greater in terms of sorting.
`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` | `supportsSourceType(Class<?> sourceType)` Determine whether this listener actually supports the given source type.

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<ApplicationEvent>`
  Parameters:
    `event` - the event to respond to

### supportsEventType

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

  Description copied from interface: `SmartApplicationListener`
  Determine whether this listener actually supports the given event type.

  Specified by:
    `supportsEventType` in interface `SmartApplicationListener`

### supportsSourceType

    public boolean supportsSourceType(Class<?> sourceType)

  Description copied from interface: `SmartApplicationListener`
  Determine whether this listener actually supports the given source type.

  Specified by:
    `supportsSourceType` in interface `SmartApplicationListener`

### getOrder

    public int getOrder()

  Description copied from interface: `Ordered`
  Return the order value of this object, with a higher value meaning greater in terms of sorting.

  Normally starting with 0, with `Integer.MAX_VALUE` indicating the greatest value. Same order values will result in arbitrary positions for the affected objects.

  Higher values can be interpreted as lower priority. As a consequence, the object with the lowest value has highest priority (somewhat analogous to Servlet "load-on-startup" values).

  Specified by:
    `getOrder` in interface `Ordered`
  Returns:
    the order value

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

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD