Polishing

This commit is contained in:
Juergen Hoeller
2018-08-10 18:00:17 +02:00
parent 1695ef7e87
commit 951b39cc7a
9 changed files with 77 additions and 66 deletions

View File

@@ -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");
* you may not use this file except in compliance with the License.
@@ -24,23 +24,27 @@ import org.springframework.lang.Nullable;
/**
* 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
* proper handling of generics-based event.
* <p>As of Spring Framework 4.2, this interface supersedes the Class-based
* {@link SmartApplicationListener} with full handling of generic event types.
*
* @author Stephane Nicoll
* @since 4.2
* @see SmartApplicationListener
* @see GenericApplicationListenerAdapter
*/
public interface GenericApplicationListener extends ApplicationListener<ApplicationEvent>, Ordered {
/**
* Determine whether this listener actually supports the given event type.
* @param eventType the event type (never {@code null})
*/
boolean supportsEventType(ResolvableType eventType);
/**
* Determine whether this listener actually supports the given source type.
* @param sourceType the source type, or {@code null} if no source
*/
boolean supportsSourceType(@Nullable Class<?> sourceType);

View File

@@ -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");
* you may not use this file except in compliance with the License.
@@ -23,25 +23,27 @@ import org.springframework.lang.Nullable;
/**
* 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>Users are <bold>strongly advised</bold> to use the {@link GenericApplicationListener}
* interface instead as it provides an improved detection of generics-based
* event types.
* <p>For full introspection of generic event types, consider implementing
* the {@link GenericApplicationListener} interface instead.
*
* @author Juergen Hoeller
* @since 3.0
* @see GenericApplicationListener
* @see GenericApplicationListenerAdapter
*/
public interface SmartApplicationListener extends ApplicationListener<ApplicationEvent>, Ordered {
/**
* Determine whether this listener actually supports the given event type.
* @param eventType the event type (never {@code null})
*/
boolean supportsEventType(Class<? extends ApplicationEvent> eventType);
/**
* Determine whether this listener actually supports the given source type.
* @param sourceType the source type, or {@code null} if no source
*/
boolean supportsSourceType(@Nullable Class<?> sourceType);