public class GenericApplicationListenerAdapter extends java.lang.Object implements SmartApplicationListener
SmartApplicationListener
adapter that determines supported event types
through introspecting the generically declared type of the target listener.ApplicationListener.onApplicationEvent(E)
Modifier and Type | Field and Description |
---|---|
private ApplicationListener<ApplicationEvent> |
delegate |
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
Constructor and Description |
---|
GenericApplicationListenerAdapter(ApplicationListener<?> delegate)
Create a new GenericApplicationListener for the given delegate.
|
Modifier and Type | Method and Description |
---|---|
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.
|
(package private) static java.lang.Class<?> |
resolveDeclaredEventType(java.lang.Class<?> listenerType) |
boolean |
supportsEventType(java.lang.Class<? extends ApplicationEvent> eventType)
Determine whether this listener actually supports the given event type.
|
boolean |
supportsSourceType(java.lang.Class<?> sourceType)
Determine whether this listener actually supports the given source type.
|
private final ApplicationListener<ApplicationEvent> delegate
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(java.lang.Class<? extends ApplicationEvent> eventType)
SmartApplicationListener
supportsEventType
in interface SmartApplicationListener
public boolean supportsSourceType(java.lang.Class<?> sourceType)
SmartApplicationListener
supportsSourceType
in interface SmartApplicationListener
public int getOrder()
Ordered
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).
static java.lang.Class<?> resolveDeclaredEventType(java.lang.Class<?> listenerType)