mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-27 06:17:27 +00:00
clarified WeakRaceLogChangedVisitor constructor behavior by adding a Javadoc comment
This commit is contained in:
1 parent
fd626e2db5
commit
d920ca9b0b
2 files changed
+16
-1
No files matched your search
+6
@@ -3,6 +3,12 @@ package com.sap.sailing.domain.abstractlog.race.impl;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogChangedListener;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
|
||||
/**
|
||||
* Forwards events received by this visitor to the listener passed to the constructor.
|
||||
*
|
||||
* @author Axel Uhl (D043530)
|
||||
*
|
||||
*/
|
||||
public class RaceLogChangedVisitor extends AbstractRaceLogChangedVisitor {
|
||||
private final RaceLogChangedListener listener;
|
||||
|
||||
|
||||
+10
-1
@@ -14,7 +14,10 @@ import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
|
||||
/**
|
||||
* A listener that unregisters itself from the race log's listeners if its notification target is no longer strongly
|
||||
* referenced.
|
||||
* referenced. Note that the visitor is <em>not</em> automatically registered by the constructor although the
|
||||
* {@link RaceLog} object is passed in.
|
||||
* {@link RaceLog#addListener(com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor) registration} of this visitor
|
||||
* as a listener on the {@link RaceLog} has to happen explicitly by the client.
|
||||
*
|
||||
* @author Axel Uhl (d043530)
|
||||
*
|
||||
@@ -45,6 +48,12 @@ public class WeakRaceLogChangedVisitor extends AbstractRaceLogChangedVisitor {
|
||||
private final WeakReference<RaceLogChangedListener> listenerRef;
|
||||
private final RaceLog removeFromThisRaceLogWhenListenerNoLongerStronglyReferenced;
|
||||
|
||||
/**
|
||||
* Remembers from which {@link RaceLog} to {@link RaceLog#removeListener(Object) remove} this visitor as a listener
|
||||
* when the <code>listener</code> is no longer strongly referenced. This constructor does <em>not</em> register this
|
||||
* visitor as a listener on the {@link RaceLog}. This has to happen explicitly by the caller after this constructor
|
||||
* has returned.
|
||||
*/
|
||||
public WeakRaceLogChangedVisitor(RaceLog removeFromThisRaceLogWhenListenerNoLongerStronglyReferenced, RaceLogChangedListener listener) {
|
||||
this.removeFromThisRaceLogWhenListenerNoLongerStronglyReferenced = removeFromThisRaceLogWhenListenerNoLongerStronglyReferenced;
|
||||
listenerRef = new WeakReference<RaceLogChangedListener>(listener, queue);
|
||||
|
||||
Reference in new issue
Block a user