Spring Framework

org.springframework.context.event
Class GenericApplicationListenerAdapter

java.lang.Object
  extended by org.springframework.context.event.GenericApplicationListenerAdapter
All Implemented Interfaces:
java.util.EventListener, ApplicationListener<ApplicationEvent>, SmartApplicationListener, Ordered

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.

Since:
3.0
Author:
Juergen Hoeller
See Also:
ApplicationListener.onApplicationEvent(E)

Field Summary
 
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
 
Constructor Summary
GenericApplicationListenerAdapter(ApplicationListener delegate)
          Create a new GenericApplicationListener for the given delegate.
 
Method Summary
 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.
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenericApplicationListenerAdapter

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

Parameters:
delegate - the delegate listener to be invoked
Method Detail

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(java.lang.Class<? extends ApplicationEvent> eventType)
Description copied from interface: SmartApplicationListener
Determine whether this listener actually supports the given event type.

Specified by:
supportsEventType in interface SmartApplicationListener

supportsSourceType

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

Specified by:
supportsSourceType in interface SmartApplicationListener

getOrder

public int getOrder()
Description copied from interface: Ordered
Return the order value of this object, with a higher value meaning greater in terms of sorting.

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).

Specified by:
getOrder in interface Ordered
Returns:
the order value

Spring Framework