Polish Javadoc for application event infrastructure
This commit is contained in:
parent
e6d206b45a
commit
2b88c47477
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2018 the original author or authors.
|
* Copyright 2002-2019 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,6 +24,8 @@ import java.util.EventObject;
|
||||||
*
|
*
|
||||||
* @author Rod Johnson
|
* @author Rod Johnson
|
||||||
* @author Juergen Hoeller
|
* @author Juergen Hoeller
|
||||||
|
* @see org.springframework.context.ApplicationListener
|
||||||
|
* @see org.springframework.context.event.EventListener
|
||||||
*/
|
*/
|
||||||
public abstract class ApplicationEvent extends EventObject {
|
public abstract class ApplicationEvent extends EventObject {
|
||||||
|
|
||||||
|
@ -35,8 +37,9 @@ public abstract class ApplicationEvent extends EventObject {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new ApplicationEvent.
|
* Create a new {@code ApplicationEvent}.
|
||||||
* @param source the object on which the event initially occurred (never {@code null})
|
* @param source the object on which the event initially occurred or with
|
||||||
|
* which the event is associated (never {@code null})
|
||||||
*/
|
*/
|
||||||
public ApplicationEvent(Object source) {
|
public ApplicationEvent(Object source) {
|
||||||
super(source);
|
super(source);
|
||||||
|
@ -45,7 +48,7 @@ public abstract class ApplicationEvent extends EventObject {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the system time in milliseconds when the event happened.
|
* Return the system time in milliseconds when the event occurred.
|
||||||
*/
|
*/
|
||||||
public final long getTimestamp() {
|
public final long getTimestamp() {
|
||||||
return this.timestamp;
|
return this.timestamp;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2016 the original author or authors.
|
* Copyright 2002-2019 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.
|
||||||
|
@ -18,7 +18,8 @@ package org.springframework.context;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface that encapsulates event publication functionality.
|
* Interface that encapsulates event publication functionality.
|
||||||
* Serves as super-interface for {@link ApplicationContext}.
|
*
|
||||||
|
* <p>Serves as a super-interface for {@link ApplicationContext}.
|
||||||
*
|
*
|
||||||
* @author Juergen Hoeller
|
* @author Juergen Hoeller
|
||||||
* @author Stephane Nicoll
|
* @author Stephane Nicoll
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2016 the original author or authors.
|
* Copyright 2002-2019 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.
|
||||||
|
@ -20,18 +20,21 @@ import java.util.EventListener;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface to be implemented by application event listeners.
|
* Interface to be implemented by application event listeners.
|
||||||
* Based on the standard {@code java.util.EventListener} interface
|
*
|
||||||
|
* <p>Based on the standard {@code java.util.EventListener} interface
|
||||||
* for the Observer design pattern.
|
* for the Observer design pattern.
|
||||||
*
|
*
|
||||||
* <p>As of Spring 3.0, an ApplicationListener can generically declare the event type
|
* <p>As of Spring 3.0, an {@code ApplicationListener} can generically declare
|
||||||
* that it is interested in. When registered with a Spring ApplicationContext, events
|
* the event type that it is interested in. When registered with a Spring
|
||||||
* will be filtered accordingly, with the listener getting invoked for matching event
|
* {@code ApplicationContext}, events will be filtered accordingly, with the
|
||||||
* objects only.
|
* listener getting invoked for matching event objects only.
|
||||||
*
|
*
|
||||||
* @author Rod Johnson
|
* @author Rod Johnson
|
||||||
* @author Juergen Hoeller
|
* @author Juergen Hoeller
|
||||||
* @param <E> the specific ApplicationEvent subclass to listen to
|
* @param <E> the specific {@code ApplicationEvent} subclass to listen to
|
||||||
|
* @see org.springframework.context.ApplicationEvent
|
||||||
* @see org.springframework.context.event.ApplicationEventMulticaster
|
* @see org.springframework.context.event.ApplicationEventMulticaster
|
||||||
|
* @see org.springframework.context.event.EventListener
|
||||||
*/
|
*/
|
||||||
@FunctionalInterface
|
@FunctionalInterface
|
||||||
public interface ApplicationListener<E extends ApplicationEvent> extends EventListener {
|
public interface ApplicationListener<E extends ApplicationEvent> extends EventListener {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2017 the original author or authors.
|
* Copyright 2002-2019 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.
|
||||||
|
@ -23,15 +23,16 @@ import org.springframework.lang.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface to be implemented by objects that can manage a number of
|
* Interface to be implemented by objects that can manage a number of
|
||||||
* {@link ApplicationListener} objects, and publish events to them.
|
* {@link ApplicationListener} objects and publish events to them.
|
||||||
*
|
*
|
||||||
* <p>An {@link org.springframework.context.ApplicationEventPublisher}, typically
|
* <p>An {@link org.springframework.context.ApplicationEventPublisher}, typically
|
||||||
* a Spring {@link org.springframework.context.ApplicationContext}, can use an
|
* a Spring {@link org.springframework.context.ApplicationContext}, can use an
|
||||||
* ApplicationEventMulticaster as a delegate for actually publishing events.
|
* {@code ApplicationEventMulticaster} as a delegate for actually publishing events.
|
||||||
*
|
*
|
||||||
* @author Rod Johnson
|
* @author Rod Johnson
|
||||||
* @author Juergen Hoeller
|
* @author Juergen Hoeller
|
||||||
* @author Stephane Nicoll
|
* @author Stephane Nicoll
|
||||||
|
* @see ApplicationListener
|
||||||
*/
|
*/
|
||||||
public interface ApplicationEventMulticaster {
|
public interface ApplicationEventMulticaster {
|
||||||
|
|
||||||
|
@ -55,21 +56,21 @@ public interface ApplicationEventMulticaster {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a listener bean from the notification list.
|
* Remove a listener bean from the notification list.
|
||||||
* @param listenerBeanName the name of the listener bean to add
|
* @param listenerBeanName the name of the listener bean to remove
|
||||||
*/
|
*/
|
||||||
void removeApplicationListenerBean(String listenerBeanName);
|
void removeApplicationListenerBean(String listenerBeanName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove all listeners registered with this multicaster.
|
* Remove all listeners registered with this multicaster.
|
||||||
* <p>After a remove call, the multicaster will perform no action
|
* <p>After a remove call, the multicaster will perform no action
|
||||||
* on event notification until new listeners are being registered.
|
* on event notification until new listeners are registered.
|
||||||
*/
|
*/
|
||||||
void removeAllListeners();
|
void removeAllListeners();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Multicast the given application event to appropriate listeners.
|
* Multicast the given application event to appropriate listeners.
|
||||||
* <p>Consider using {@link #multicastEvent(ApplicationEvent, ResolvableType)}
|
* <p>Consider using {@link #multicastEvent(ApplicationEvent, ResolvableType)}
|
||||||
* if possible as it provides a better support for generics-based events.
|
* if possible as it provides better support for generics-based events.
|
||||||
* @param event the event to multicast
|
* @param event the event to multicast
|
||||||
*/
|
*/
|
||||||
void multicastEvent(ApplicationEvent event);
|
void multicastEvent(ApplicationEvent event);
|
||||||
|
@ -79,7 +80,7 @@ public interface ApplicationEventMulticaster {
|
||||||
* <p>If the {@code eventType} is {@code null}, a default type is built
|
* <p>If the {@code eventType} is {@code null}, a default type is built
|
||||||
* based on the {@code event} instance.
|
* based on the {@code event} instance.
|
||||||
* @param event the event to multicast
|
* @param event the event to multicast
|
||||||
* @param eventType the type of event (can be null)
|
* @param eventType the type of event (can be {@code null})
|
||||||
* @since 4.2
|
* @since 4.2
|
||||||
*/
|
*/
|
||||||
void multicastEvent(ApplicationEvent event, @Nullable ResolvableType eventType);
|
void multicastEvent(ApplicationEvent event, @Nullable ResolvableType eventType);
|
||||||
|
|
Loading…
Reference in New Issue