|
|
@ -1,5 +1,5 @@ |
|
|
|
/* |
|
|
|
/* |
|
|
|
* Copyright 2002-2017 the original author or authors. |
|
|
|
* Copyright 2002-2018 the original author or authors. |
|
|
|
* |
|
|
|
* |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
@ -24,24 +24,40 @@ import org.springframework.lang.Nullable; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Extended variant of the standard {@link ApplicationListener} interface, |
|
|
|
* Extended variant of the standard {@link ApplicationListener} interface, |
|
|
|
* exposing further metadata such as the supported event type. |
|
|
|
* exposing further metadata such as the supported event and source type. |
|
|
|
* |
|
|
|
* |
|
|
|
* <p>As of Spring Framework 4.2, supersedes {@link SmartApplicationListener} with |
|
|
|
* <p>As of Spring Framework 4.2, this interface supersedes the Class-based |
|
|
|
* proper handling of generics-based event. |
|
|
|
* {@link SmartApplicationListener} with full handling of generic event types. |
|
|
|
* |
|
|
|
* |
|
|
|
* @author Stephane Nicoll |
|
|
|
* @author Stephane Nicoll |
|
|
|
* @since 4.2 |
|
|
|
* @since 4.2 |
|
|
|
|
|
|
|
* @see SmartApplicationListener |
|
|
|
|
|
|
|
* @see GenericApplicationListenerAdapter |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public interface GenericApplicationListener extends ApplicationListener<ApplicationEvent>, Ordered { |
|
|
|
public interface GenericApplicationListener extends ApplicationListener<ApplicationEvent>, Ordered { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Determine whether this listener actually supports the given event type. |
|
|
|
* Determine whether this listener actually supports the given event type. |
|
|
|
|
|
|
|
* @param eventType the event type (never {@code null}) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
boolean supportsEventType(ResolvableType eventType); |
|
|
|
boolean supportsEventType(ResolvableType eventType); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Determine whether this listener actually supports the given source type. |
|
|
|
* Determine whether this listener actually supports the given source type. |
|
|
|
|
|
|
|
* <p>The default implementation always returns {@code true}. |
|
|
|
|
|
|
|
* @param sourceType the source type, or {@code null} if no source |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
boolean supportsSourceType(@Nullable Class<?> sourceType); |
|
|
|
default boolean supportsSourceType(@Nullable Class<?> sourceType) { |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Determine this listener's order in a set of listeners for the same event. |
|
|
|
|
|
|
|
* <p>The default implementation returns {@link #LOWEST_PRECEDENCE}. |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
default int getOrder() { |
|
|
|
|
|
|
|
return LOWEST_PRECEDENCE; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|