EventSetDescriptor.java revision 243
243N/A * Copyright 1996-2008 Sun Microsystems, Inc. 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. Sun designates this 0N/A * particular file as subject to the "Classpath" exception as provided 0N/A * by Sun 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, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 0N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 0N/A * CA 95054 USA or visit www.sun.com if you need additional information or 0N/A * have any questions. 0N/A * An EventSetDescriptor describes a group of events that a given Java 0N/A * The given group of events are all delivered as method calls on a single 0N/A * event listener interface, and an event listener object can be registered 0N/A * via a call on a registration method supplied by the event source. 0N/A * Creates an <TT>EventSetDescriptor</TT> assuming that you are 0N/A * following the most simple standard design pattern where a named 0N/A * event "fred" is (1) delivered as a call on the single method of 0N/A * interface FredListener, (2) has a single argument of type FredEvent, 0N/A * and (3) where the FredListener may be registered with a call on an 0N/A * addFredListener method of the source component and removed with a 0N/A * call on a removeFredListener method. 0N/A * @param sourceClass The class firing the event. 0N/A * @param eventSetName The programmatic name of the event. E.g. "fred". 0N/A * Note that this should normally start with a lower-case character. 0N/A * @param listenerType The target interface that events 0N/A * will get delivered to. 0N/A * @param listenerMethodName The method that will get called when the event gets 0N/A * delivered to its target listener interface. 0N/A * @exception IntrospectionException if an exception occurs during 0N/A // Check for EventSet compliance. Special case for vetoableChange. See 4529996 0N/A "\" should have argument \"" +
0N/A * Creates an <TT>EventSetDescriptor</TT> from scratch using 0N/A * @param sourceClass The class firing the event. 0N/A * @param eventSetName The programmatic name of the event set. 0N/A * Note that this should normally start with a lower-case character. 0N/A * @param listenerType The Class of the target interface that events 0N/A * will get delivered to. 0N/A * @param listenerMethodNames The names of the methods that will get called 0N/A * when the event gets delivered to its target listener interface. 0N/A * @param addListenerMethodName The name of the method on the event source 0N/A * that can be used to register an event listener object. 0N/A * @param removeListenerMethodName The name of the method on the event source 0N/A * that can be used to de-register an event listener object. 0N/A * @exception IntrospectionException if an exception occurs during 0N/A * This constructor creates an EventSetDescriptor from scratch using 0N/A * @param sourceClass The class firing the event. 0N/A * @param eventSetName The programmatic name of the event set. 0N/A * Note that this should normally start with a lower-case character. 0N/A * @param listenerType The Class of the target interface that events 0N/A * will get delivered to. 0N/A * @param listenerMethodNames The names of the methods that will get called 0N/A * when the event gets delivered to its target listener interface. 0N/A * @param addListenerMethodName The name of the method on the event source 0N/A * that can be used to register an event listener object. 0N/A * @param removeListenerMethodName The name of the method on the event source 0N/A * that can be used to de-register an event listener object. 0N/A * @param getListenerMethodName The method on the event source that 0N/A * can be used to access the array of event listener objects. 0N/A * @exception IntrospectionException if an exception occurs during 0N/A // Check for null names 0N/A // Be more forgiving of not finding the getListener method. 0N/A * Creates an <TT>EventSetDescriptor</TT> from scratch using 0N/A * <TT>java.lang.reflect.Method</TT> and <TT>java.lang.Class</TT> objects. 0N/A * @param eventSetName The programmatic name of the event set. 0N/A * @param listenerType The Class for the listener interface. 0N/A * @param listenerMethods An array of Method objects describing each 0N/A * of the event handling methods in the target listener. 0N/A * @param addListenerMethod The method on the event source 0N/A * that can be used to register an event listener object. 0N/A * @param removeListenerMethod The method on the event source 0N/A * that can be used to de-register an event listener object. 0N/A * @exception IntrospectionException if an exception occurs during 0N/A * This constructor creates an EventSetDescriptor from scratch using 0N/A * java.lang.reflect.Method and java.lang.Class objects. 0N/A * @param eventSetName The programmatic name of the event set. 0N/A * @param listenerType The Class for the listener interface. 0N/A * @param listenerMethods An array of Method objects describing each 0N/A * of the event handling methods in the target listener. 0N/A * @param addListenerMethod The method on the event source 0N/A * that can be used to register an event listener object. 0N/A * @param removeListenerMethod The method on the event source 0N/A * that can be used to de-register an event listener object. 0N/A * @param getListenerMethod The method on the event source 0N/A * that can be used to access the array of event listener objects. 0N/A * @exception IntrospectionException if an exception occurs during 0N/A * Creates an <TT>EventSetDescriptor</TT> from scratch using 0N/A * <TT>java.lang.reflect.MethodDescriptor</TT> and <TT>java.lang.Class</TT> 0N/A * @param eventSetName The programmatic name of the event set. 0N/A * @param listenerType The Class for the listener interface. 0N/A * @param listenerMethodDescriptors An array of MethodDescriptor objects 0N/A * describing each of the event handling methods in the 0N/A * @param addListenerMethod The method on the event source 0N/A * that can be used to register an event listener object. 0N/A * @param removeListenerMethod The method on the event source 0N/A * that can be used to de-register an event listener object. 0N/A * @exception IntrospectionException if an exception occurs during 0N/A * Gets the <TT>Class</TT> object for the target interface. 0N/A * @return The Class object for the target interface that will 0N/A * get invoked when the event is fired. 0N/A * Gets the methods of the target listener interface. 0N/A * @return An array of <TT>Method</TT> objects for the target methods 0N/A * within the target listener interface that will get called when 0N/A * Gets the <code>MethodDescriptor</code>s of the target listener interface. 0N/A * @return An array of <code>MethodDescriptor</code> objects for the target methods 0N/A * within the target listener interface that will get called when 0N/A * Gets the method used to add event listeners. 0N/A * @return The method used to register a listener at the event source. 0N/A * Gets the method used to remove event listeners. 0N/A * @return The method used to remove a listener at the event source. 0N/A * Gets the method used to access the registered event listeners. 0N/A * @return The method used to access the array of listeners at the event 0N/A * source or null if it doesn't exist. 0N/A * Mark an event set as unicast (or not). 0N/A * @param unicast True if the event set is unicast. 0N/A * Normally event sources are multicast. However there are some 0N/A * exceptions that are strictly unicast. 0N/A * @return <TT>true</TT> if the event set is unicast. 0N/A * Defaults to <TT>false</TT>. 0N/A * Marks an event set as being in the "default" set (or not). 0N/A * By default this is <TT>true</TT>. 0N/A * @param inDefaultEventSet <code>true</code> if the event set is in 0N/A * the "default" set, 0N/A * <code>false</code> if not 0N/A * Reports if an event set is in the "default" set. 0N/A * @return <TT>true</TT> if the event set is in 0N/A * the "default" set. Defaults to <TT>true</TT>. 0N/A * Package-private constructor 0N/A * Merge two event set descriptors. Where they conflict, give the 0N/A * second argument (y) priority over the first argument (x). 0N/A * @param x The first (lower priority) EventSetDescriptor 0N/A * @param y The second (higher priority) EventSetDescriptor 0N/A * Package-private dup constructor 0N/A * This must isolate the new object from any changes to the old object. 0N/A for (
int i =
0; i <
len; i++) {