EventSetDescriptor
EventSetDescriptor (이벤트 셋 설명자)
주어진 Java 빈이 발생시키는 이벤트의 그룹을 설명하는 클래스예요. 이 그룹의 이벤트들은 모두 단일 이벤트 리스너 인터페이스에 대한 메서드 호출로 전달되고, 이벤트 리스너 객체는 이벤트 소스가 제공하는 등록 메서드 호출을 통해 등록될 수 있어요.
본문
EventSetDescriptor는 FeatureDescriptor를 상속하는 클래스예요. 빈이 지원하는 이벤트 셋(예: ActionEvent 셋)의 구조를 기술하며, 여러 생성자를 통해 소스 클래스·리스너 타입·리스너 메서드 이름 등을 지정할 수 있어요. 생성 과정에서 잘못된 정보가 주어지면 IntrospectionException이 발생해요.
주요 생성자와 메서드는 다음과 같아요.
public EventSetDescriptor(Class<?> sourceClass, String eventSetName, Class<?> listenerType,
String listenerMethodName) throws IntrospectionException
public EventSetDescriptor(Class<?> sourceClass, String eventSetName, Class<?> listenerType,
String[] listenerMethodNames, String addListenerMethodName, String removeListenerMethodName)
throws IntrospectionException
public EventSetDescriptor(String eventSetName, Class<?> listenerType, Method[] listenerMethods,
Method addListenerMethod, Method removeListenerMethod) throws IntrospectionException
public Class<?> getListenerType()
public Method[] getListenerMethods()
getListenerType()— 이 이벤트 셋의 리스너 인터페이스 타입을 반환해요.getListenerMethods()— 리스너 인터페이스가 정의하는 이벤트 핸들러 메서드 배열을 반환해요.
이 descriptor는 BeanInfo.getEventSetDescriptors()가 반환하는 객체예요.