Example usage for org.springframework.context.event GenericApplicationListenerAdapter GenericApplicationListenerAdapter

List of usage examples for org.springframework.context.event GenericApplicationListenerAdapter GenericApplicationListenerAdapter

Introduction

In this page you can find the example usage for org.springframework.context.event GenericApplicationListenerAdapter GenericApplicationListenerAdapter.

Prototype

@SuppressWarnings("unchecked")
public GenericApplicationListenerAdapter(ApplicationListener<?> delegate) 

Source Link

Document

Create a new GenericApplicationListener for the given delegate.

Usage

From source file:org.alfresco.repo.management.SafeApplicationEventMulticaster.java

/**
 * Determine whether the given listener supports the given event.
 * <p>/*from w w w .j a v  a 2  s.c  o m*/
 * The default implementation detects the {@link SmartApplicationListener}
 * interface. In case of a standard {@link ApplicationListener}, a
 * {@link GenericApplicationListenerAdapter} will be used to introspect the
 * generically declared type of the target listener.
 * 
 * @param listener
 *            the target listener to check
 * @param eventType
 *            the event type to check against
 * @param sourceType
 *            the source type to check against
 * @return whether the given listener should be included in the candidates
 *         for the given event type
 */
protected boolean supportsEvent(ApplicationListener listener, Class<? extends ApplicationEvent> eventType,
        Class sourceType) {

    SmartApplicationListener smartListener = (listener instanceof SmartApplicationListener
            ? (SmartApplicationListener) listener
            : new GenericApplicationListenerAdapter(listener));
    return (smartListener.supportsEventType(eventType) && smartListener.supportsSourceType(sourceType));
}