- java.lang.Object
-
- java.beans.FeatureDescriptor
-
- java.beans.EventSetDescriptor
-
public class EventSetDescriptor extends FeatureDescriptor
EventSetDescriptor描述给定的Java Bean触发的一组事件。给定的事件组在单个事件侦听器接口上作为方法调用传递,并且可以通过事件源提供的注册方法的调用来注册事件侦听器对象。
- 从以下版本开始:
- 1.1
-
-
构造方法摘要
构造方法 Constructor 描述 EventSetDescriptor(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, 方法 addListenerMethod, 方法 removeListenerMethod)创建一个EventSetDescriptor使用从无到有java.lang.reflect.MethodDescriptor个java.lang.Class对象。EventSetDescriptor(String eventSetName, Class<?> listenerType, 方法[] listenerMethods, 方法 addListenerMethod, 方法 removeListenerMethod)创建一个EventSetDescriptor使用从无到有java.lang.reflect.Method个java.lang.Class对象。EventSetDescriptor(String eventSetName, Class<?> listenerType, 方法[] listenerMethods, 方法 addListenerMethod, 方法 removeListenerMethod, 方法 getListenerMethod)此构造函数从头开始使用java.lang.reflect.Method和java.lang.Class对象创建一个EventSetDescriptor。
-
方法摘要
所有方法 接口方法 具体的方法 Modifier and Type 方法 描述 方法getAddListenerMethod()获取用于添加事件侦听器的方法。方法getGetListenerMethod()获取用于访问已注册事件侦听器的方法。MethodDescriptor[]getListenerMethodDescriptors()获取目标侦听器界面的MethodDescriptors。方法[]getListenerMethods()获取目标侦听器接口的方法。Class<?>getListenerType()获取目标接口的Class对象。方法getRemoveListenerMethod()获取用于删除事件侦听器的方法。booleanisInDefaultEventSet()报告事件集是否在“默认”集中。booleanisUnicast()通常情况来源是组播。voidsetInDefaultEventSet(boolean inDefaultEventSet)将事件设置为“默认”集(或不是)。voidsetUnicast(boolean unicast)将事件设置为单播(或不)。-
Methods inherited from class java.beans.FeatureDescriptor
attributeNames, getDisplayName, getName, getShortDescription, getValue, isExpert, isHidden, isPreferred, setDisplayName, setExpert, setHidden, setName, setPreferred, setShortDescription, setValue, toString
-
-
-
-
构造方法详细信息
-
EventSetDescriptor
public EventSetDescriptor(Class<?> sourceClass, String eventSetName, Class<?> listenerType, String listenerMethodName) throws IntrospectionException
创建一个EventSetDescriptor假设您遵循最简单的标准设计模式,其中一个命名事件“fred”(1)作为调用接口FredListener的一个方法传递,(2)具有类型为FredEvent的单个参数, 3)FredListener可以通过对源组件的addFredListener方法的调用进行注册,并通过removeFredListener方法的调用进行删除。- 参数
-
sourceClass- 该类触发事件。 -
eventSetName- 事件的编程名称。 例如“fred”。 请注意,这通常应以小写字符开头。 -
listenerType- 事件将传递到的目标界面。 -
listenerMethodName- 当事件传递到其目标侦听器接口时将被调用的方法。 - 异常
-
IntrospectionException- 如果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- 如果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- 如果IntrospectionException期间发生异常。 - 从以下版本开始:
- 1.4
-
EventSetDescriptor
public EventSetDescriptor(String eventSetName, Class<?> listenerType, 方法[] listenerMethods, 方法 addListenerMethod, 方法 removeListenerMethod) throws IntrospectionException
使用java.lang.reflect.Method和java.lang.Class对象从头开始创建一个EventSetDescriptor。- 参数
-
eventSetName- 事件集的编程名称。 -
listenerType- 侦听器接口的类。 -
listenerMethods- 描述目标侦听器中每个事件处理方法的Method对象数组。 -
addListenerMethod- 可用于注册事件侦听器对象的事件源上的方法。 -
removeListenerMethod- 可用于取消注册事件侦听器对象的事件源上的方法。 - 异常
-
IntrospectionException- 如果IntrospectionException期间发生异常。
-
EventSetDescriptor
public EventSetDescriptor(String eventSetName, Class<?> listenerType, 方法[] listenerMethods, 方法 addListenerMethod, 方法 removeListenerMethod, 方法 getListenerMethod) throws IntrospectionException
此构造函数从头开始使用java.lang.reflect.Method和java.lang.Class对象创建一个EventSetDescriptor。- 参数
-
eventSetName- 事件集的编程名称。 -
listenerType- 侦听器接口的类。 -
listenerMethods- 描述目标侦听器中每个事件处理方法的Method对象数组。 -
addListenerMethod- 可用于注册事件侦听器对象的事件源上的方法。 -
removeListenerMethod- 可用于取消注册事件侦听器对象的事件源上的方法。 -
getListenerMethod- 可用于访问事件侦听器对象数组的事件源上的方法。 - 异常
-
IntrospectionException- 如果IntrospectionException期间发生异常。 - 从以下版本开始:
- 1.4
-
EventSetDescriptor
public EventSetDescriptor(String eventSetName, Class<?> listenerType, MethodDescriptor[] listenerMethodDescriptors, 方法 addListenerMethod, 方法 removeListenerMethod) throws IntrospectionException
使用java.lang.reflect.MethodDescriptor和java.lang.Class对象从头创建一个EventSetDescriptor。- 参数
-
eventSetName- 事件集的编程名称。 -
listenerType- 侦听器接口的类。 -
listenerMethodDescriptors- 描述目标侦听器中每个事件处理方法的MethodDescriptor对象数组。 -
addListenerMethod- 可用于注册事件侦听器对象的事件源上的方法。 -
removeListenerMethod- 可用于取消注册事件侦听器对象的事件源上的方法。 - 异常
-
IntrospectionException- 如果IntrospectionException期间发生异常。
-
-
方法详细信息
-
getListenerType
public Class<?> getListenerType()
获取目标接口的Class对象。- 结果
- 当触发事件时将被调用的目标接口的Class对象。
-
getListenerMethods
public 方法[] getListenerMethods()
获取目标侦听器接口的方法。- 结果
-
一组
方法对象,用于目标侦听器接口中的目标方法,当触发事件时将被调用。
-
getListenerMethodDescriptors
public MethodDescriptor[] getListenerMethodDescriptors()
获取目标侦听器界面的MethodDescriptors。- 结果
-
一组
MethodDescriptor对象,用于目标侦听器接口中的目标方法,当触发事件时将被调用。
-
getAddListenerMethod
public 方法 getAddListenerMethod()
获取用于添加事件侦听器的方法。- 结果
- 用于在事件源处注册侦听器的方法。
-
getRemoveListenerMethod
public 方法 getRemoveListenerMethod()
获取用于删除事件侦听器的方法。- 结果
- 用于在事件源处删除侦听器的方法。
-
getGetListenerMethod
public 方法 getGetListenerMethod()
获取用于访问已注册事件侦听器的方法。- 结果
- 用于访问事件源上的侦听器数组的方法,如果不存在,则返回null。
- 从以下版本开始:
- 1.4
-
setUnicast
public void setUnicast(boolean unicast)
将事件设置为单播(或不)。- 参数
-
unicast- 如果事件集是单播,unicast真。
-
isUnicast
public boolean isUnicast()
通常情况来源是组播。 但是有一些严格单播的例外。- 结果
-
true如果事件集是单播的。 默认为false。
-
setInDefaultEventSet
public void setInDefaultEventSet(boolean inDefaultEventSet)
将事件设置为“默认”集(或不是)。 默认情况下是true。- 参数
-
inDefaultEventSet-true如果事件集是在“默认”集,false如果不是
-
isInDefaultEventSet
public boolean isInDefaultEventSet()
报告事件集是否在“默认”集中。- 结果
-
true如果事件集是在“默认”集。 默认为true。
-
-