EventListenerAggregate.java revision 2362
4278N/A * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 0N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 0N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 1472N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 0N/A * or visit www.oracle.com if you need additional information or have any 1879N/A * A class that assists in managing {@link java.util.EventListener}s of 1879N/A * the specified type. Its instance holds an array of listeners of the same 1879N/A * type and allows to perform the typical operations on the listeners. 1879N/A * This class is thread-safe. 1879N/A * @author Alexander Gerasimov 1879N/A * Constructs an <code>EventListenerAggregate</code> object. 1879N/A * @param listenerClass the type of the listeners to be managed by this object 1879N/A * @throws NullPointerException if <code>listenerClass</code> is 1879N/A * @throws ClassCastException if <code>listenerClass</code> is not 1879N/A * assignable to <code>java.util.EventListener</code> 1879N/A " is not assignable to EventListener");
1879N/A * Adds the listener to this aggregate. 1879N/A * @param listener the listener to be added 1879N/A * @throws ClassCastException if <code>listener</code> is not 1879N/A * an instatce of <code>listenerClass</code> specified 0N/A * Removes a listener that is equal to the given one from this aggregate. 0N/A * <code>equals()</code> method is used to compare listeners. 0N/A * @param listener the listener to be removed 0N/A * @return <code>true</code> if this aggregate contained the specified 0N/A * <code>listener</code>; <code>false</code> otherwise 0N/A * @throws ClassCastException if <code>listener</code> is not 0N/A * an instatce of <code>listenerClass</code> specified 0N/A * in the constructor 0N/A * Returns an array of all the listeners contained in this aggregate. 0N/A * The array is the data structure in which listeners are stored internally. 0N/A * The runtime type of the returned array is "array of <code>listenerClass</code>" 0N/A * (<code>listenerClass</code> has been specified as a parameter to 0N/A * the constructor of this class). 0N/A * @return all the listeners contained in this aggregate (an empty 0N/A * array if there are no listeners) 0N/A * Returns an array of all the listeners contained in this aggregate. 0N/A * The array is a copy of the data structure in which listeners are stored 0N/A * The runtime type of the returned array is "array of <code>listenerClass</code>" 0N/A * (<code>listenerClass</code> has been specified as a parameter to 0N/A * the constructor of this class). 0N/A * @return a copy of all the listeners contained in this aggregate (an empty 0N/A * array if there are no listeners) 0N/A * Returns the number of lisetners in this aggregate. 242N/A * @return the number of lisetners in this aggregate 2627N/A * Returns <code>true</code> if this aggregate contains no listeners, 2627N/A * <code>false</code> otherwise. 2627N/A * @return <code>true</code> if this aggregate contains no listeners, 2627N/A * <code>false</code> otherwise