public interface SmartApplicationListener extends ApplicationListener<ApplicationEvent>, Ordered
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.
GenericApplicationListener
,
GenericApplicationListenerAdapter
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
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.
|
forPayload, onApplicationEvent
boolean supportsEventType(Class<? extends ApplicationEvent> eventType)
eventType
- the event type (never null
)default boolean supportsSourceType(@Nullable Class<?> sourceType)
The default implementation always returns true
.
sourceType
- the source type, or null
if no sourcedefault int getOrder()
The default implementation returns Ordered.LOWEST_PRECEDENCE
.
getOrder
in interface Ordered
Ordered.HIGHEST_PRECEDENCE
,
Ordered.LOWEST_PRECEDENCE
default String getListenerId()
The default value is an empty String.