source: trunk/src/gcc/libjava/java/beans/EventSetDescriptor.java@ 192

Last change on this file since 192 was 2, checked in by bird, 23 years ago

Initial revision

  • Property cvs2svn:cvs-rev set to 1.1
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 19.3 KB
Line 
1/* java.beans.EventSetDescriptor
2 Copyright (C) 1998 Free Software Foundation, Inc.
3
4This file is part of GNU Classpath.
5
6GNU Classpath is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2, or (at your option)
9any later version.
10
11GNU Classpath is distributed in the hope that it will be useful, but
12WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with GNU Classpath; see the file COPYING. If not, write to the
18Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
1902111-1307 USA.
20
21Linking this library statically or dynamically with other modules is
22making a combined work based on this library. Thus, the terms and
23conditions of the GNU General Public License cover the whole
24combination.
25
26As a special exception, the copyright holders of this library give you
27permission to link this library with independent modules to produce an
28executable, regardless of the license terms of these independent
29modules, and to copy and distribute the resulting executable under
30terms of your choice, provided that you also meet, for each linked
31independent module, the terms and conditions of the license of that
32module. An independent module is a module which is not derived from
33or based on this library. If you modify this library, you may extend
34this exception to your version of the library, but you are not
35obligated to do so. If you do not wish to do so, delete this
36exception statement from your version. */
37
38
39package java.beans;
40
41import java.util.*;
42import java.lang.reflect.*;
43import gnu.java.lang.*;
44
45/**
46 ** EventSetDescriptor describes the hookup between an event source
47 ** class and an event listener class.
48 **
49 ** EventSets have several attributes: the listener class, the events
50 ** that can be fired to the listener (methods in the listener class), and
51 ** an add and remove listener method from the event firer's class.<P>
52 **
53 ** The methods have these constraints on them:<P>
54 ** <UL>
55 ** <LI>event firing methods: must have <CODE>void</CODE> return value. Any
56 ** parameters and exceptions are allowed. May be public, protected or
57 ** package-protected. (Don't ask me why that is, I'm just following the spec.
58 ** The only place it is even mentioned is in the Java Beans white paper, and
59 ** there it is only implied.)</LI>
60 ** <LI>add listener method: must have <CODE>void</CODE> return value. Must
61 ** take exactly one argument, of the listener class's type. May fire either
62 ** zero exceptions, or one exception of type <CODE>java.util.TooManyListenersException</CODE>.
63 ** Must be public.</LI>
64 ** <LI>remove listener method: must have <CODE>void</CODE> return value.
65 ** Must take exactly one argument, of the listener class's type. May not
66 ** fire any exceptions. Must be public.</LI>
67 ** </UL>
68 **
69 ** A final constraint is that event listener classes must extend from EventListener.<P>
70 **
71 ** There are also various design patterns associated with some of the methods
72 ** of construction. Those are explained in more detail in the appropriate
73 ** constructors.<P>
74 **
75 ** <STRONG>Documentation Convention:</STRONG> for proper
76 ** Internalization of Beans inside an RAD tool, sometimes there
77 ** are two names for a property or method: a programmatic, or
78 ** locale-independent name, which can be used anywhere, and a
79 ** localized, display name, for ease of use. In the
80 ** documentation I will specify different String values as
81 ** either <EM>programmatic</EM> or <EM>localized</EM> to
82 ** make this distinction clear.
83 **
84 ** @author John Keiser
85 ** @since JDK1.1
86 ** @version 1.1.0, 31 May 1998
87 **/
88
89public class EventSetDescriptor extends FeatureDescriptor {
90 private Method addListenerMethod;
91 private Method removeListenerMethod;
92 private Class listenerType;
93 private MethodDescriptor[] listenerMethodDescriptors;
94 private Method[] listenerMethods;
95
96 private boolean unicast;
97 private boolean inDefaultEventSet = true;
98
99 /** Create a new EventSetDescriptor.
100 ** This version of the constructor enforces the rules imposed on the methods
101 ** described at the top of this class, as well as searching for:<P>
102 ** <OL>
103 ** <LI>The event-firing method must be non-private with signature
104 ** <CODE>void &lt;listenerMethodName&gt;(&lt;eventSetName&gt;Event)</CODE>
105 ** (where <CODE>&lt;eventSetName&gt;</CODE> has its first character capitalized