java.lang.Object
java.beans.FeatureDescriptor
java.beans.EventSetDescriptor
一个 EventSetDescriptor 描述了给定 Java bean 触发的一组事件。
给定的事件组都作为单个事件监听器接口上的方法调用传递,事件监听器对象可以通过事件源提供的注册方法进行注册。
- 自版本:
- 1.1
-
Constructor Summary
ConstructorsConstructorDescriptionEventSetDescriptor(Class<?> sourceClass, String eventSetName, Class<?> listenerType, String listenerMethodName) 假设您遵循最简单的标准设计模式,创建一个EventSetDescriptor,其中一个名为 "fred" 的事件 (1) 作为对接口 FredListener 的单个方法的调用传递,(2) 具有类型为 FredEvent 的单个参数,(3) FredListener 可以通过源组件上的 addFredListener 方法进行注册,并通过 removeFredListener 方法进行移除。EventSetDescriptor(Class<?> sourceClass, String eventSetName, Class<?> listenerType, String[] listenerMethodNames, String addListenerMethodName, String removeListenerMethodName) 使用字符串名称从头开始创建一个EventSetDescriptor。EventSetDescriptor(Class<?> sourceClass, String eventSetName, Class<?> listenerType, String[] listenerMethodNames, String addListenerMethodName, String removeListenerMethodName, String getListenerMethodName) 使用字符串名称从头开始创建一个 EventSetDescriptor。EventSetDescriptor(String eventSetName, Class<?> listenerType, MethodDescriptor[] listenerMethodDescriptors, Method addListenerMethod, Method removeListenerMethod) 使用java.lang.reflect.MethodDescriptor和java.lang.Class对象从头开始创建一个EventSetDescriptor。EventSetDescriptor(String eventSetName, Class<?> listenerType, Method[] listenerMethods, Method addListenerMethod, Method removeListenerMethod) 使用java.lang.reflect.Method和java.lang.Class对象从头开始创建一个EventSetDescriptor。EventSetDescriptor(String eventSetName, Class<?> listenerType, Method[] listenerMethods, Method addListenerMethod, Method removeListenerMethod, Method getListenerMethod) 使用 java.lang.reflect.Method 和 java.lang.Class 对象从头开始创建一个 EventSetDescriptor。 -
Method Summary
Modifier and TypeMethodDescription获取用于添加事件监听器的方法。获取用于访问已注册事件监听器的方法。获取目标监听器接口的MethodDescriptor。Method[]获取目标监听器接口的方法。Class<?> 获取目标接口的Class对象。获取用于移除事件监听器的方法。boolean报告事件集是否在 "默认" 集中。boolean通常事件源是多播的。voidsetInDefaultEventSet(boolean inDefaultEventSet) 将事件集标记为在 "默认" 集中(或不在)。voidsetUnicast(boolean unicast) 将事件集标记为单播(或不是)。Methods declared in class java.beans.FeatureDescriptor
attributeNames, getDisplayName, getName, getShortDescription, getValue, isExpert, isHidden, isPreferred, setDisplayName, setExpert, setHidden, setName, setPreferred, setShortDescription, setValue, toString
-
Constructor Details
-
EventSetDescriptor
public EventSetDescriptor(Class<?> sourceClass, String eventSetName, Class<?> listenerType, String listenerMethodName) throws IntrospectionException 假设您遵循最简单的标准设计模式,创建一个名为 "fred" 的事件的EventSetDescriptor,其中 (1) 作为对接口 FredListener 的单个方法的调用传递,(2) 具有类型为 FredEvent 的单个参数,(3) FredListener 可以通过源组件上的 addFredListener 方法进行注册,并通过 removeFredListener 方法进行移除。- 参数:
-
sourceClass- 触发事件的类。 -
eventSetName- 事件的程序名称。例如 "fred"。注意,这通常应以小写字符开头。 -
listenerType- 事件将传递到的目标接口。 -
listenerMethodName- 事件传递到其目标监听器接口时将调用的方法。 - 抛出:
-
IntrospectionException- 如果在内省期间发生异常。
-
EventSetDescriptor
public EventSetDescriptor(Class<?> sourceClass, String eventSetName, Class<?> listenerType, String[] listenerMethodNames, String addListenerMethodName, String removeListenerMethodName) throws IntrospectionException 使用字符串名称从头开始创建一个EventSetDescriptor。- 参数:
-
sourceClass- 触发事件的类。 -
eventSetName- 事件集的程序名称。注意,这通常应以小写字符开头。 -
listenerType- 事件将传递到的目标接口的类。 -
listenerMethodNames- 事件传递到其目标监听器接口时将调用的方法的名称。 -
addListenerMethodName- 可用于注册事件监听器对象的事件源上的方法的名称。 -
removeListenerMethodName- 可用于注销事件监听器对象的事件源上的方法的名称。 - 抛出:
-
IntrospectionException- 如果在内省期间发生异常。
-
EventSetDescriptor
public EventSetDescriptor(Class<?> sourceClass, String eventSetName, Class<?> listenerType, String[] listenerMethodNames, String addListenerMethodName, String removeListenerMethodName, String getListenerMethodName) throws IntrospectionException 使用字符串名称从头开始创建一个EventSetDescriptor。- 参数:
-
sourceClass- 触发事件的类。 -
eventSetName- 事件集的程序名称。注意,这通常应以小写字符开头。 -
listenerType- 事件将传递到的目标接口的类。 -
listenerMethodNames- 事件传递到其目标监听器接口时将调用的方法的名称。 -
addListenerMethodName- 可用于注册事件监听器对象的事件源上的方法的名称。 -
removeListenerMethodName- 可用于注销事件监听器对象的事件源上的方法的名称。 -
getListenerMethodName- 可用于访问事件监听器对象数组的事件源上的方法的名称。 - 抛出:
-
IntrospectionException- 如果在内省期间发生异常。 - 自版本:
- 1.4
-
EventSetDescriptor
public EventSetDescriptor(String eventSetName, Class<?> listenerType, Method[] listenerMethods, Method addListenerMethod, Method removeListenerMethod) throws IntrospectionException 使用java.lang.reflect.Method和java.lang.Class对象从头开始创建一个EventSetDescriptor。- 参数:
-
eventSetName- 事件集的程序名称。 -
listenerType- 监听器接口的类。 -
listenerMethods- 描述目标监听器中每个事件处理方法的 Method 对象数组。 -
addListenerMethod- 可用于注册事件监听器对象的事件源上的方法。 -
removeListenerMethod- 可用于注销事件监听器对象的事件源上的方法。 - 抛出:
-
IntrospectionException- 如果在内省期间发生异常。
-
EventSetDescriptor
public EventSetDescriptor(String eventSetName, Class<?> listenerType, Method[] listenerMethods, Method addListenerMethod, Method removeListenerMethod, Method getListenerMethod) throws IntrospectionException 使用java.lang.reflect.Method和java.lang.Class对象从头开始创建一个EventSetDescriptor。- 参数:
-
eventSetName- 事件集的程序名称。 -
listenerType- 监听器接口的类。 -
listenerMethods- 描述目标监听器中每个事件处理方法的 Method 对象数组。 -
addListenerMethod- 可用于注册事件监听器对象的事件源上的方法。 -
removeListenerMethod- 可用于注销事件监听器对象的事件源上的方法。 -
getListenerMethod- 可用于访问事件监听器对象数组的事件源上的方法。 - 抛出:
-
IntrospectionException- 如果在内省期间发生异常。 - 自版本:
- 1.4
-
EventSetDescriptor
public EventSetDescriptor(String eventSetName, Class<?> listenerType, MethodDescriptor[] listenerMethodDescriptors, Method addListenerMethod, Method removeListenerMethod) throws IntrospectionException 使用java.lang.reflect.MethodDescriptor和java.lang.Class对象从头开始创建一个EventSetDescriptor。- 参数:
-
eventSetName- 事件集的程序名称。 -
listenerType- 监听器接口的类。 -
listenerMethodDescriptors- 描述目标监听器中每个事件处理方法的 MethodDescriptor 对象数组。 -
addListenerMethod- 可用于注册事件监听器对象的事件源上的方法。 -
removeListenerMethod- 可用于注销事件监听器对象的事件源上的方法。 - 抛出:
-
IntrospectionException- 如果在内省期间发生异常。
-
-
Method Details
-
getListenerType
获取目标接口的Class对象。- 返回:
- 将在触发事件时调用的目标接口的 Class 对象。
-
getListenerMethods
获取目标监听器接口的方法。- 返回:
-
一个包含目标监听器接口中将在事件触发时调用的方法的
Method对象数组。
-
getListenerMethodDescriptors
获取目标监听器接口的MethodDescriptor。- 返回:
-
一个包含目标监听器接口中将在事件触发时调用的方法的
MethodDescriptor对象数组。
-
getAddListenerMethod
获取用于添加事件监听器的方法。- 返回:
- 用于在事件源上注册监听器的方法。
-
getRemoveListenerMethod
获取用于移除事件监听器的方法。- 返回:
- 用于在事件源上移除监听器的方法。
-
getGetListenerMethod
获取用于访问已注册事件监听器的方法。- 返回:
- 用于访问事件源上的监听器数组的方法,如果不存在则返回 null。
- 自版本:
- 1.4
-
setUnicast
public void setUnicast(boolean unicast) 将事件集标记为单播(或不是)。- 参数:
-
unicast- 如果事件集是单播,则为 true。
-
isUnicast
public boolean isUnicast()通常事件源是多播的。但是有一些严格单播的例外情况。- 返回:
-
如果事件集是单播,则返回
true。默认为false。
-
setInDefaultEventSet
public void setInDefaultEventSet(boolean inDefaultEventSet) 将事件集标记为在 "默认" 集中(或不在)。默认情况下为true。- 参数:
-
inDefaultEventSet- 如果事件集在 "默认" 集中,则为true,否则为false。
-
isInDefaultEventSet
public boolean isInDefaultEventSet()报告事件集是否在 "默认" 集中。- 返回:
-
如果事件集在 "默认" 集中,则返回
true。默认为true。
-