-
Notifications
You must be signed in to change notification settings - Fork 182
Description
Describe your motivation
Currently, it is not easily possible to get the number of registered listeners for a certain, exact eventType.
Method com.vaadin.flow.component.ComponentEventBus#getListeners
does also include subTypes of the given eventType, which is not always wanted.
For example the call eventBus.getListeners(ItemClickEvent.class)
returns a collection that also contains listeners for ItemDoubleClickEvent
, since it is a subType of ItemClickEvent
. Distinguishing the eventTypes in the returned collection is cumbersome.
Describe the solution you'd like
It would be helpful if there was a method that given a listener, returns its exact eventType. The method signature would be something like public Class<? extends ComponentEvent> getListenerEventType(Object listener)
. This would allow to iterate over the collection returned by com.vaadin.flow.component.ComponentEventBus#getListeners
and check the eventType for every listener.
Describe alternatives you've considered
Using reflection.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status