APIdia Launch Partner
Top Description Fields Constructors Methods
java.beans

public Class EventSetDescriptor

extends FeatureDescriptor
Class Inheritance
Imports
java.lang.ref.Reference, java.lang.reflect.Method, .Modifier, com.sun.beans.introspect.EventSetInfo

An EventSetDescriptor describes a group of events that a given Java bean fires.

The given group of events are all delivered as method calls on a single event listener interface, and an event listener object can be registered via a call on a registration method supplied by the event source.

Since
1.1

Field Summary

Modifier and TypeField and Description
private MethodDescriptor
private MethodDescriptor
private boolean
private MethodDescriptor[]
private Reference<Method[]>
private Reference<? extends Class<?>>
private MethodDescriptor
private boolean

Constructor Summary

AccessConstructor and Description
public
EventSetDescriptor(Class<?>
The class firing the event.
sourceClass
,
String
The programmatic name of the event. E.g. "fred". Note that this should normally start with a lower-case character.
eventSetName
,
Class<?>
The target interface that events will get delivered to.
listenerType
,
String
The method that will get called when the event gets delivered to its target listener interface.
listenerMethodName
)

Creates an EventSetDescriptor assuming that you are following the most simple standard design pattern where a named event "fred" is (1) delivered as a call on the single method of interface FredListener, (2) has a single argument of type FredEvent, and (3) where the FredListener may be registered with a call on an addFredListener method of the source component and removed with a call on a removeFredListener method.

public
EventSetDescriptor(Class<?>
The class firing the event.
sourceClass
,
String
The programmatic name of the event set. Note that this should normally start with a lower-case character.
eventSetName
,
Class<?>
The Class of the target interface that events will get delivered to.
listenerType
,
String[]
The names of the methods that will get called when the event gets delivered to its target listener interface.
listenerMethodNames
,
String
The name of the method on the event source that can be used to register an event listener object.
addListenerMethodName
,
String
The name of the method on the event source that can be used to de-register an event listener object.
removeListenerMethodName
)

Creates an EventSetDescriptor from scratch using string names.

public
EventSetDescriptor(Class<?>
The class firing the event.
sourceClass
,
String
The programmatic name of the event set. Note that this should normally start with a lower-case character.
eventSetName
,
Class<?>
The Class of the target interface that events will get delivered to.
listenerType
,
String[]
The names of the methods that will get called when the event gets delivered to its target listener interface.
listenerMethodNames
,
String
The name of the method on the event source that can be used to register an event listener object.
addListenerMethodName
,
String
The name of the method on the event source that can be used to de-register an event listener object.
removeListenerMethodName
,
String
The method on the event source that can be used to access the array of event listener objects.
getListenerMethodName
)

This constructor creates an EventSetDescriptor from scratch using string names.

public
EventSetDescriptor(String
The programmatic name of the event set.
eventSetName
,
Class<?>
The Class for the listener interface.
listenerType
,
Method[]
An array of Method objects describing each of the event handling methods in the target listener.
listenerMethods
,
Method
The method on the event source that can be used to register an event listener object.
addListenerMethod
,
Method
The method on the event source that can be used to de-register an event listener object.
removeListenerMethod
)

Creates an EventSetDescriptor from scratch using java.lang.reflect.Method and java.lang.Class objects.

public
EventSetDescriptor(String
The programmatic name of the event set.
eventSetName
,
Class<?>
The Class for the listener interface.
listenerType
,
Method[]
An array of Method objects describing each of the event handling methods in the target listener.
listenerMethods
,
Method
The method on the event source that can be used to register an event listener object.
addListenerMethod
,
Method
The method on the event source that can be used to de-register an event listener object.
removeListenerMethod
,
Method
The method on the event source that can be used to access the array of event listener objects.
getListenerMethod
)

This constructor creates an EventSetDescriptor from scratch using java.lang.reflect.Method and java.lang.Class objects.

pack-priv
EventSetDescriptor(String base, EventSetInfo info, Method... methods)

public
EventSetDescriptor(String
The programmatic name of the event set.
eventSetName
,
Class<?>
The Class for the listener interface.
listenerType
,
MethodDescriptor[]
An array of MethodDescriptor objects describing each of the event handling methods in the target listener.
listenerMethodDescriptors
,
Method
The method on the event source that can be used to register an event listener object.
addListenerMethod
,
Method
The method on the event source that can be used to de-register an event listener object.
removeListenerMethod
)

Creates an EventSetDescriptor from scratch using java.lang.reflect.MethodDescriptor and java.lang.Class objects.

pack-priv
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv void
public synchronized Method

Returns:

The method used to register a listener at the event source.
getAddListenerMethod
()

Gets the method used to add event listeners.

public synchronized Method

Returns:

The method used to access the array of listeners at the event source or null if it doesn't exist.
getGetListenerMethod
()

Gets the method used to access the registered event listeners.

private static String
public synchronized MethodDescriptor[]

Returns:

An array of MethodDescriptor objects for the target methods within the target listener interface that will get called when events are fired.
getListenerMethodDescriptors
()

Gets the MethodDescriptors of the target listener interface.

public synchronized Method[]

Returns:

An array of Method objects for the target methods within the target listener interface that will get called when events are fired.
getListenerMethods
()

Gets the methods of the target listener interface.

private Method[]
public Class<?>

Returns:

The Class object for the target interface that will get invoked when the event is fired.
getListenerType
()

Gets the Class object for the target interface.

private static Method
getMethod(Class<?> cls, String name, int args)

private static Method
public synchronized Method

Returns:

The method used to remove a listener at the event source.
getRemoveListenerMethod
()

Gets the method used to remove event listeners.

public boolean

Returns:

true if the event set is in the "default" set. Defaults to true.
isInDefaultEventSet
()

Reports if an event set is in the "default" set.

public boolean

Returns:

true if the event set is unicast. Defaults to false.
isUnicast
()

Normally event sources are multicast.

private synchronized void
private synchronized void
public void
setInDefaultEventSet(boolean
true if the event set is in the "default" set, false if not
inDefaultEventSet
)

Marks an event set as being in the "default" set (or not).

private void
private void
private synchronized void
public void
setUnicast(boolean
True if the event set is unicast.
unicast
)

Mark an event set as unicast (or not).

Inherited from java.beans.FeatureDescriptor:
appendToappendToappendToattributeNamesgetClass0getDisplayNamegetNamegetParameterTypesgetReturnTypegetShortDescriptiongetSoftReferencegetValuegetWeakReferenceisExpertisHiddenisPreferredisTransientsetClass0setDisplayNamesetExpertsetHiddensetNamesetPreferredsetShortDescriptionsetTransientsetValuetoString

Field Detail

addMethodDescriptorback to summary
private MethodDescriptor addMethodDescriptor
getMethodDescriptorback to summary
private MethodDescriptor getMethodDescriptor
inDefaultEventSetback to summary
private boolean inDefaultEventSet
listenerMethodDescriptorsback to summary
private MethodDescriptor[] listenerMethodDescriptors
listenerMethodsRefback to summary
private Reference<Method[]> listenerMethodsRef
listenerTypeRefback to summary
private Reference<? extends Class<?>> listenerTypeRef
removeMethodDescriptorback to summary
private MethodDescriptor removeMethodDescriptor
unicastback to summary
private boolean unicast

Constructor Detail

EventSetDescriptorback to summary
public EventSetDescriptor(Class<?> sourceClass, String eventSetName, Class<?> listenerType, String listenerMethodName) throws IntrospectionException

Creates an EventSetDescriptor assuming that you are following the most simple standard design pattern where a named event "fred" is (1) delivered as a call on the single method of interface FredListener, (2) has a single argument of type FredEvent, and (3) where the FredListener may be registered with a call on an addFredListener method of the source component and removed with a call on a removeFredListener method.

Parameters
sourceClass:Class<?>

The class firing the event.

eventSetName:String

The programmatic name of the event. E.g. "fred". Note that this should normally start with a lower-case character.

listenerType:Class<?>

The target interface that events will get delivered to.

listenerMethodName:String

The method that will get called when the event gets delivered to its target listener interface.

Exceptions
IntrospectionException:
if an exception occurs during introspection.
EventSetDescriptorback to summary
public EventSetDescriptor(Class<?> sourceClass, String eventSetName, Class<?> listenerType, String[] listenerMethodNames, String addListenerMethodName, String removeListenerMethodName) throws IntrospectionException

Creates an EventSetDescriptor from scratch using string names.

Parameters
sourceClass:Class<?>

The class firing the event.

eventSetName:String

The programmatic name of the event set. Note that this should normally start with a lower-case character.

listenerType:Class<?>

The Class of the target interface that events will get delivered to.

listenerMethodNames:String[]

The names of the methods that will get called when the event gets delivered to its target listener interface.

addListenerMethodName:String

The name of the method on the event source that can be used to register an event listener object.

removeListenerMethodName:String

The name of the method on the event source that can be used to de-register an event listener object.

Exceptions
IntrospectionException:
if an exception occurs during introspection.
EventSetDescriptorback to summary
public EventSetDescriptor(Class<?> sourceClass, String eventSetName, Class<?> listenerType, String[] listenerMethodNames, String addListenerMethodName, String removeListenerMethodName, String getListenerMethodName) throws IntrospectionException

This constructor creates an EventSetDescriptor from scratch using string names.

Parameters
sourceClass:Class<?>

The class firing the event.

eventSetName:String

The programmatic name of the event set. Note that this should normally start with a lower-case character.

listenerType:Class<?>

The Class of the target interface that events will get delivered to.

listenerMethodNames:String[]

The names of the methods that will get called when the event gets delivered to its target listener interface.

addListenerMethodName:String

The name of the method on the event source that can be used to register an event listener object.

removeListenerMethodName:String

The name of the method on the event source that can be used to de-register an event listener object.

getListenerMethodName:String

The method on the event source that can be used to access the array of event listener objects.

Exceptions
IntrospectionException:
if an exception occurs during introspection.
Since
1.4
EventSetDescriptorback to summary
public EventSetDescriptor(String eventSetName, Class<?> listenerType, Method[] listenerMethods, Method addListenerMethod, Method removeListenerMethod) throws IntrospectionException

Creates an EventSetDescriptor from scratch using java.lang.reflect.Method and java.lang.Class objects.

Parameters
eventSetName:String

The programmatic name of the event set.

listenerType:Class<?>

The Class for the listener interface.

listenerMethods:Method[]

An array of Method objects describing each of the event handling methods in the target listener.

addListenerMethod:Method

The method on the event source that can be used to register an event listener object.

removeListenerMethod:Method

The method on the event source that can be used to de-register an event listener object.

Exceptions
IntrospectionException:
if an exception occurs during introspection.
EventSetDescriptorback to summary
public EventSetDescriptor(String eventSetName, Class<?> listenerType, Method[] listenerMethods, Method addListenerMethod, Method removeListenerMethod, Method getListenerMethod) throws IntrospectionException

This constructor creates an EventSetDescriptor from scratch using java.lang.reflect.Method and java.lang.Class objects.

Parameters
eventSetName:String

The programmatic name of the event set.

listenerType:Class<?>

The Class for the listener interface.

listenerMethods:Method[]

An array of Method objects describing each of the event handling methods in the target listener.

addListenerMethod:Method

The method on the event source that can be used to register an event listener object.

removeListenerMethod:Method

The method on the event source that can be used to de-register an event listener object.

getListenerMethod:Method

The method on the event source that can be used to access the array of event listener objects.

Exceptions
IntrospectionException:
if an exception occurs during introspection.
Since
1.4
EventSetDescriptorback to summary
pack-priv EventSetDescriptor(String base, EventSetInfo info, Method... methods)
EventSetDescriptorback to summary
public EventSetDescriptor(String eventSetName, Class<?> listenerType, MethodDescriptor[] listenerMethodDescriptors, Method addListenerMethod, Method removeListenerMethod) throws IntrospectionException

Creates an EventSetDescriptor from scratch using java.lang.reflect.MethodDescriptor and java.lang.Class objects.

Parameters
eventSetName:String

The programmatic name of the event set.

listenerType:Class<?>

The Class for the listener interface.

listenerMethodDescriptors:MethodDescriptor[]

An array of MethodDescriptor objects describing each of the event handling methods in the target listener.

addListenerMethod:Method

The method on the event source that can be used to register an event listener object.

removeListenerMethod:Method

The method on the event source that can be used to de-register an event listener object.

Exceptions
IntrospectionException:
if an exception occurs during introspection.
EventSetDescriptorback to summary
pack-priv EventSetDescriptor(EventSetDescriptor x, EventSetDescriptor y)
EventSetDescriptorback to summary
pack-priv EventSetDescriptor(EventSetDescriptor old)

Method Detail

appendToback to summary
pack-priv void appendTo(StringBuilder sb)

Overrides java.beans.FeatureDescriptor.appendTo.

Annotations
@Override
getAddListenerMethodback to summary
public synchronized Method getAddListenerMethod()

Gets the method used to add event listeners.

Returns:Method

The method used to register a listener at the event source.

getGetListenerMethodback to summary
public synchronized Method getGetListenerMethod()

Gets the method used to access the registered event listeners.

Returns:Method

The method used to access the array of listeners at the event source or null if it doesn't exist.

Since
1.4
getListenerClassNameback to summary
private static String getListenerClassName(Class<?> cls)
getListenerMethodDescriptorsback to summary
public synchronized MethodDescriptor[] getListenerMethodDescriptors()

Gets the MethodDescriptors of the target listener interface.

Returns:MethodDescriptor[]

An array of MethodDescriptor objects for the target methods within the target listener interface that will get called when events are fired.

getListenerMethodsback to summary
public synchronized Method[] getListenerMethods()

Gets the methods of the target listener interface.

Returns:Method[]

An array of Method objects for the target methods within the target listener interface that will get called when events are fired.

getListenerMethods0back to summary
private Method[] getListenerMethods0()
getListenerTypeback to summary
public Class<?> getListenerType()

Gets the Class object for the target interface.

Returns:Class<?>

The Class object for the target interface that will get invoked when the event is fired.

getMethodback to summary
private static Method getMethod(Class<?> cls, String name, int args) throws IntrospectionException
getMethodback to summary
private static Method getMethod(MethodDescriptor descriptor)
getRemoveListenerMethodback to summary
public synchronized Method getRemoveListenerMethod()

Gets the method used to remove event listeners.

Returns:Method

The method used to remove a listener at the event source.

isInDefaultEventSetback to summary
public boolean isInDefaultEventSet()

Reports if an event set is in the "default" set.

Returns:boolean

true if the event set is in the "default" set. Defaults to true.

isUnicastback to summary
public boolean isUnicast()

Normally event sources are multicast. However there are some exceptions that are strictly unicast.

Returns:boolean

true if the event set is unicast. Defaults to false.

setAddListenerMethodback to summary
private synchronized void setAddListenerMethod(Method method)
setGetListenerMethodback to summary
private synchronized void setGetListenerMethod(Method method)
setInDefaultEventSetback to summary
public void setInDefaultEventSet(boolean inDefaultEventSet)

Marks an event set as being in the "default" set (or not). By default this is true.

Parameters
inDefaultEventSet:boolean

true if the event set is in the "default" set, false if not

setListenerMethodsback to summary
private void setListenerMethods(Method[] methods)
setListenerTypeback to summary
private void setListenerType(Class<?> cls)
setRemoveListenerMethodback to summary
private synchronized void setRemoveListenerMethod(Method method)
setUnicastback to summary
public void setUnicast(boolean unicast)

Mark an event set as unicast (or not).

Parameters
unicast:boolean

True if the event set is unicast.