Hello list,

Inspired by the neat configuration Module for guice persist, I decided
to make something similar for a small subpart of my project. I'm not
fully sure how to create it though.

I want to create a module which sets up the relationship between
listeners and dispatchers in an event system. The event system is
based on a class called ListenerDispatcher<T> [1]. I want the module
to work something like this:

protected void configureEvents() {
    connect(ListeningInterface.class,
ClassImplementingListeningInterface.class);
    // .... and so on
}

protected void configure() {
    configureEvents();
}

What I want that line to do is:

ListenerDispatcher<ListeningInterface> listenerDispatcher =
ListenerDispatcher.create(ListeningInterface.class);
listenerDispatcher.addListener(classImplementingListeningInterface);

Initially I wouldn't need to be able to configure the scope of the
binding. I just want to reduce the boiler plate to that single line
(compared to a lot of configuration atm). My initial thoughts is that
I store all the connect bindings in a map or similar until the
configure() method of AbstractModule is run. In configure I bind/
create all the ListenerDispatchers. So far it's fine, I'm not just
sure how to runt the addListener part.

Thanks for any pointers or help!

[1] http://pastie.org/private/e20zdyb9nwbmjgq9vgkjhw



-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" 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-guice?hl=en.

Reply via email to