org.springframework.context.event

## Interface SmartApplicationListener

- All Superinterfaces:
    ApplicationListener<ApplicationEvent>, EventListener, Ordered
  All Known Subinterfaces:
    GenericApplicationListener
  All Known Implementing Classes:
    ApplicationListenerMethodAdapter, DefaultSimpUserRegistry, GenericApplicationListenerAdapter, MultiServerUserRegistry, SourceFilteringListener, TransactionalApplicationListenerMethodAdapter

      public interface SmartApplicationListener
      extends ApplicationListener<ApplicationEvent>, Ordered

  Extended variant of the standard `ApplicationListener` interface, exposing further metadata such as the supported event and source type.

  For full introspection of generic event types, consider implementing the `GenericApplicationListener` interface instead.

  Since:
    3.0
  Author:
    Juergen Hoeller
  See Also:
    `GenericApplicationListener`, `GenericApplicationListenerAdapter`

- - ### Field Summary

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

      `HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `default String` | `getListenerId()` Return an optional identifier for the listener.
    `default int` | `getOrder()` Determine this listener's order in a set of listeners for the same event.
    `boolean` | `supportsEventType(Class<? extends ApplicationEvent> eventType)` Determine whether this listener actually supports the given event type.
    `default boolean` | `supportsSourceType(Class<?> sourceType)` Determine whether this listener actually supports the given source type.

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

      `forPayload, onApplicationEvent`

- - ### Method Detail

    - #### supportsEventType

          boolean supportsEventType(Class<? extends ApplicationEvent> eventType)

      Determine whether this listener actually supports the given event type.
      Parameters:
        `eventType` - the event type (never `null`)

    - #### supportsSourceType

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

      Determine whether this listener actually supports the given source type.

      The default implementation always returns `true`.

      Parameters:
        `sourceType` - the source type, or `null` if no source

    - #### getOrder

          default int getOrder()

      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 `Ordered`
      Returns:
        the order value
      See Also:
        `Ordered.HIGHEST_PRECEDENCE`, `Ordered.LOWEST_PRECEDENCE`

    - #### getListenerId

          default String getListenerId()

      Return an optional identifier for the listener.

      The default value is an empty String.

      Since:
        5.3.5
      See Also:
        `EventListener.id()`, `ApplicationEventMulticaster.removeApplicationListeners(java.util.function.Predicate<org.springframework.context.ApplicationListener<?>>)`