java.lang.Object | +--java.beans.FeatureDescriptor | +--java.beans.EventSetDescriptor
EventSetDescriptor(java.lang.Class eventSourceClass, java.lang.String eventSetName, java.lang.Class listenerType, java.lang.String listenerMethodName) Create a new EventSetDescriptor. |
EventSetDescriptor(java.lang.Class eventSourceClass, java.lang.String eventSetName, java.lang.Class listenerType, java.lang.String[] listenerMethodNames, java.lang.String addListenerMethodName, java.lang.String removeListenerMethodName) Create a new EventSetDescriptor. |
EventSetDescriptor(java.lang.String eventSetName, java.lang.Class listenerType, java.lang.reflect.Method listenerMethods, java.lang.reflect.Method addListenerMethod, java.lang.reflect.Method removeListenerMethod) Create a new EventSetDescriptor. |
EventSetDescriptor(java.lang.String eventSetName, java.lang.Class listenerType, java.beans.MethodDescriptor listenerMethodDescriptors, java.lang.reflect.Method addListenerMethod, java.lang.reflect.Method removeListenerMethod) Create a new EventSetDescriptor. |
java.lang.reflect.Method | getAddListenerMethod() Get the add listener method. |
java.beans.MethodDescriptor[] | getListenerMethodDescriptors() Get the event firing methods as MethodDescriptors. |
java.lang.reflect.Method[] | getListenerMethods() Get the event firing methods. |
java.lang.Class | getListenerType() Get the class that contains the event firing methods. |
java.lang.reflect.Method | getRemoveListenerMethod() Get the remove listener method. |
boolean | isInDefaultEventSet() Get whether or not this is in the default event set. |
boolean | isUnicast() Get whether or not multiple listeners may be added. |
void | setInDefaultEventSet(boolean inDefaultEventSet) Set whether or not this is in the default event set. |
void | setUnicast(boolean unicast) Set whether or not multiple listeners may be added. |
public EventSetDescriptor(java.lang.Class eventSourceClass, java.lang.String eventSetName, java.lang.Class listenerType, java.lang.String listenerMethodName)
void <listenerMethodName>(<eventSetName>Event)
(where <eventSetName>
has its first character capitalized
by the constructor and the Event is a descendant of
java.util.EventObject
) in class listenerType
(any exceptions may be thrown).
Implementation note: Note that there could conceivably be multiple
methods with this type of signature (example: java.util.MouseEvent vs.
my.very.own.MouseEvent). In this implementation, all methods fitting the
description will be put into the EventSetDescriptor
, even
though the spec says only one should be chosen (they probably weren't thinking as
pathologically as I was). I don't like arbitrarily choosing things.
If your class has only one such signature, as most do, you'll have no problems.void add<eventSetName>Listener(<listenerType>)
and
void remove<eventSetName>Listener(<listenerType>)
in
in class eventSourceClass
, where
<eventSetName>
will have its first letter capitalized.
Standard exception rules (see class description) apply.eventSourceClass
- the class containing the add/remove listener methods.eventSetName
- the programmatic name of the event set, generally starting
with a lowercase letter (i.e.listenerType
- the class containing the event firing method.listenerMethodName
- the name of the event firing method.IntrospectionException
- if listenerType is not an EventListener,
or if methods are not found or are invalid.public EventSetDescriptor(java.lang.Class eventSourceClass, java.lang.String eventSetName, java.lang.Class listenerType, java.lang.String[] listenerMethodNames, java.lang.String addListenerMethodName, java.lang.String removeListenerMethodName)
eventSourceClass
- the class containing the add and remove listener methods.eventSetName
- the programmatic name of the event set, generally starting
with a lowercase letter (i.e.listenerType
- the class containing the event firing methods.listenerMethodNames
- the names of the even firing methods.addListenerMethodName
- the name of the add listener method.removeListenerMethodName
- the name of the remove listener method.IntrospectionException
- if listenerType is not an EventListener
or if methods are not found or are invalid.public EventSetDescriptor(java.lang.String eventSetName, java.lang.Class listenerType, java.beans.MethodDescriptor listenerMethodDescriptors, java.lang.reflect.Method addListenerMethod, java.lang.reflect.Method removeListenerMethod)
eventSetName
- the programmatic name of the event set, generally starting
with a lowercase letter (i.e.listenerType
- the class containing the listenerMethods.listenerMethodDescriptors
- the event firing methods.addListenerMethod
- the add listener method.removeListenerMethod
- the remove listener method.IntrospectionException
- if the listenerType is not an EventListener,
or any of the methods are invalid.public EventSetDescriptor(java.lang.String eventSetName, java.lang.Class listenerType, java.lang.reflect.Method listenerMethods, java.lang.reflect.Method addListenerMethod, java.lang.reflect.Method removeListenerMethod)
eventSetName
- the programmatic name of the event set, generally starting
with a lowercase letter (i.e.listenerType
- the class containing the listenerMethods.listenerMethods
- the event firing methods.addListenerMethod
- the add listener method.removeListenerMethod
- the remove listener method.IntrospectionException
- if the listenerType is not an EventListener,
or any of the methods are invalid.public Method getAddListenerMethod()
public MethodDescriptor[] getListenerMethodDescriptors()
public Method[] getListenerMethods()
public Class getListenerType()
public Method getRemoveListenerMethod()
public boolean isInDefaultEventSet()
public boolean isUnicast()
public void setInDefaultEventSet(boolean inDefaultEventSet)
inDefaultEventSet
- whether this is in the default event set.public void setUnicast(boolean unicast)
unicast
- whether or not multiple listeners may be added.
The methods have these constraints on them:
void
return value. Any parameters and exceptions are allowed. May be public, protected or package-protected. (Don't ask me why that is, I'm just following the spec. The only place it is even mentioned is in the Java Beans white paper, and there it is only implied.)void
return value. Must take exactly one argument, of the listener class's type. May fire either zero exceptions, or one exception of typejava.util.TooManyListenersException
. Must be public.void
return value. Must take exactly one argument, of the listener class's type. May not fire any exceptions. Must be public.There are also various design patterns associated with some of the methods of construction. Those are explained in more detail in the appropriate constructors.
Documentation Convention: for proper Internalization of Beans inside an RAD tool, sometimes there are two names for a property or method: a programmatic, or locale-independent name, which can be used anywhere, and a localized, display name, for ease of use. In the documentation I will specify different String values as either programmatic or localized to make this distinction clear.