@Chris,

yes, thanks for the tip, I already tried that by getSuperclass() will not get any classes that are implemented by this class but only a superclass. So I would not be able to use interfaces but only extend from a base class to which i could also attach a listener too and that would be triggered if a subclass event would be fired, but that's not the same than having the power and flexibility of interfaces.

@Nathan,

your solution is what I tried first and my junit tests would run just fine with this but GWT doesn't implement the isAssignableFrom() method, so that's why I'm looking for some alternatives if there are?

Thanks again for your great help and perhaps there are other solutions out there still?

Dominik

The JRE Emulation Reference says, that getSuperclass() is supported.
http://code.google.com/webtoolkit/doc/latest/RefJreEmulation.html
Maybe you can make do with this?

Chris

On Feb 19, 3:58 am, Dominik Steiner <[email protected]>
wrote:
Hi there,

I'm trying to implement an event bus that will receive register
listeners like this

public <T extends Event> void registerListener(Class<T>
eventClassname, EventListener<T> eventListener);
(Event is a custom interface)

what i would like then to achieve would be to be able to fire an event

public void fireEvent(Event event);

and be able to trigger all my event listeners that either are of the
same event.getClass() or that are assignable from the event class that has been fired. Getting all the listeners that correspond to the event
class itself is no problem, but how can i achieve getting all the
listeners that registered to a interface that the event class might
implement without being able to use Class.isAssignableFrom()?

Thanks for any hints and help in advance.

Dominik

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected] . To unsubscribe from this group, send email to [email protected] . For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en .


--
You received this message because you are subscribed to the Google Groups "Google 
Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to