public class GenericApplicationListenerAdapter extends Object implements GenericApplicationListener
GenericApplicationListener
adapter that determines supported event types
through introspecting the generically declared type of the target listener.ApplicationListener.onApplicationEvent(E)
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
Constructor and Description |
---|
GenericApplicationListenerAdapter(ApplicationListener<?> delegate)
Create a new GenericApplicationListener for the given delegate.
|
Modifier and Type | Method and 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(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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
supportsEventType
forPayload
public GenericApplicationListenerAdapter(ApplicationListener<?> delegate)
delegate
- the delegate listener to be invokedpublic void onApplicationEvent(ApplicationEvent event)
ApplicationListener
onApplicationEvent
in interface ApplicationListener<ApplicationEvent>
event
- the event to respond topublic boolean supportsEventType(ResolvableType eventType)
GenericApplicationListener
supportsEventType
in interface GenericApplicationListener
eventType
- the event type (never null
)public boolean supportsSourceType(@Nullable Class<?> sourceType)
SmartApplicationListener
The default implementation always returns true
.
supportsSourceType
in interface SmartApplicationListener
sourceType
- the source type, or null
if no sourcepublic int getOrder()
SmartApplicationListener
The default implementation returns Ordered.LOWEST_PRECEDENCE
.
getOrder
in interface SmartApplicationListener
getOrder
in interface Ordered
Ordered.HIGHEST_PRECEDENCE
,
Ordered.LOWEST_PRECEDENCE
public String getListenerId()
SmartApplicationListener
The default value is an empty String.