Package org.springframework.context.event

# Class GenericApplicationListenerAdapter

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

All Implemented Interfaces:
  `EventListener`, `ApplicationListener<ApplicationEvent>`, `GenericApplicationListener`, `SmartApplicationListener`, `org.springframework.core.Ordered`

public class GenericApplicationListenerAdapter extends Object implements GenericApplicationListener
`GenericApplicationListener` adapter that determines supported event types through introspecting the generically declared type of the target listener.

Since:
  3.0
Author:
  Juergen Hoeller, Stephane Nicoll
See Also:
  - `ApplicationListener.onApplicationEvent(E)`

## Field Summary

### Fields inherited from interface org.springframework.core.Ordered

`HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE`

## Constructor Summary

Constructors
Constructor
Description
`GenericApplicationListenerAdapter(ApplicationListener<?> delegate)`
Create a new GenericApplicationListener for the given delegate.

## Method Summary

Modifier and Type
Method
Description
`String`
`getListenerId()`
Return an optional identifier for the listener.
`int`
`getOrder()`
Determine this listener's order in a set of listeners for the same event.
`void`
`onApplicationEvent(ApplicationEvent event)`
Handle an application event.
`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.

### Methods inherited from class java.lang.Object

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

### Methods inherited from interface org.springframework.context.ApplicationListener

`supportsAsyncExecution`

### Methods inherited from interface org.springframework.context.event.GenericApplicationListener

`supportsEventType`

## Constructor Details

### GenericApplicationListenerAdapter

public GenericApplicationListenerAdapter(ApplicationListener<?> delegate)
Create a new GenericApplicationListener for the given delegate.

Parameters:
  `delegate` - the delegate listener to be invoked

## Method Details

### 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(org.springframework.core.ResolvableType eventType)
Description copied from interface: `GenericApplicationListener`
Determine whether this listener actually supports the given event type.

Specified by:
  `supportsEventType` in interface `GenericApplicationListener`
Parameters:
  `eventType` - the event type (never `null`)

### supportsSourceType

public boolean supportsSourceType(@Nullable Class<?> sourceType)
Description copied from interface: `SmartApplicationListener`
Determine whether this listener actually supports the given source type.

The default implementation always returns `true`.

Specified by:
  `supportsSourceType` in interface `SmartApplicationListener`
Parameters:
  `sourceType` - the source type, or `null` if no source

### getOrder

public int getOrder()
Description copied from interface: `SmartApplicationListener`
Determine this listener's order in a set of listeners for the same event.

The default implementation returns `Ordered.LOWEST_PRECEDENCE`.

Specified by:
  `getOrder` in interface `org.springframework.core.Ordered`
Specified by:
  `getOrder` in interface `SmartApplicationListener`

### getListenerId

public String getListenerId()
Description copied from interface: `SmartApplicationListener`
Return an optional identifier for the listener.

The default value is an empty String.

Specified by:
  `getListenerId` in interface `SmartApplicationListener`
See Also:
  - `EventListener.id()`
  - `ApplicationEventMulticaster.removeApplicationListeners(java.util.function.Predicate<org.springframework.context.ApplicationListener<?>>)`