Skip to content

Commit 64c77ca

Browse files
committed
Adjust JavaDoc for the EventService
We do *not* need to hold references to the subscribers anymore. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent b2dcb59 commit 64c77ca

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

src/main/java/org/scijava/event/EventService.java

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,24 @@ public interface EventService extends Service {
102102

103103
/**
104104
* Subscribes all of the given object's @{@link EventHandler} annotated
105-
* methods. This allows a single class to subscribe to multiple types of
106-
* events by implementing multiple event handling methods and annotating each
107-
* one with @{@link EventHandler}.
105+
* methods.
106+
* <p>
107+
* This allows a single class to subscribe to multiple types of events by
108+
* implementing multiple event handling methods and annotating each one with
109+
* the {@link EventHandler} annotation.
110+
* </p>
111+
* <p>
112+
* Note that it is <u>not</u> necessary to store a copy of the event
113+
* subscribers (because the event service is expected to hold a weak mapping
114+
* between the event handler object and the subscribers) <u>unless</u> the
115+
* subscribers need to be unsubscribed explicitly.
116+
* </p>
108117
*
118+
* @param o
119+
* the event handler object containing the {@link EventHandler}
120+
* annotated methods
109121
* @return The list of newly created {@link EventSubscriber}s, weakly
110-
* subscribed to the event service. These objects must not be allowed
111-
* to fall out of scope or they will be garbage collected (in which
112-
* case events will not be delivered to them!).
122+
* subscribed to the event service.
113123
*/
114124
List<EventSubscriber<?>> subscribe(Object o);
115125

0 commit comments

Comments
 (0)