Split ListenerSupport into two classes.
[jSite2.git] / src / net / pterodactylus / util / event / ListenerSupport.java
index 1b11296..a339d27 100644 (file)
 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 &lt;bombe@freenetproject.org&gt;
+ *            The type of the event listener
+ * @author David Roden &lt;droden@gmail.com&gt;
  */
-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
@@ -73,23 +59,11 @@ public class ListenerSupport<S, L> {
                }
        }
 
-       //
-       // 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
         */
@@ -99,4 +73,6 @@ public class ListenerSupport<S, L> {
                }
        }
 
+       /* TODO */
+
 }