package net.pterodactylus.util.event;
import java.util.ArrayList;
+import java.util.EventListener;
import java.util.List;
/**
- * Helper class to ease listener management.
+ * Helper class for {@link EventListener} management.
*
- * @param <S>
- * The type of the source
* @param <L>
- * The type of the listeners
- * @author David ‘Bombe’ Roden <bombe@freenetproject.org>
+ * The type of the event listener
+ * @author David Roden <droden@gmail.com>
*/
-public class ListenerSupport<S, L> {
-
- /** The source of the events. */
- private final S source;
+public class ListenerSupport<L extends EventListener> {
/** The list of registered listeners. */
private final List<L> listeners = new ArrayList<L>();
/**
- * Creates a new listener support.
- *
- * @param source
- * The source of all events
- */
- public ListenerSupport(S source) {
- this.source = source;
- }
-
- /**
* Adds a listener to the list of registered listeners.
*
* @param listener
}
}
- //
- // PROTECTED METHODS
- //
-
- /**
- * Returns the source of all events.
- *
- * @return The source of all events
- */
- protected S getSource() {
- return source;
- }
-
/**
* Returns a list of all listeners. This list is a copy of the internally
* kept list and as thus will not be modified by calls to
- * {@link #addListener(Object)} or {@link #removeListener(Object)}.
+ * {@link #addListener(EventListener)} or
+ * {@link #removeListener(EventListener)}.
*
* @return The list of all listeners
*/
}
}
+ /* TODO */
+
}