actionhandler binding impl

20 views
Skip to first unread message

joost

unread,
Dec 15, 2011, 12:02:57 PM12/15/11
to GWT Dispatch
I was skimming through the source code and noticed the implementation
of bindHandler(a,h);

protected <A extends Action<R>, R extends Result> void
bindHandler( Class<A> actionClass,

Class<? extends ActionHandler<A, R>> handlerClass ) {

bind( ActionHandlerMap.class ).annotatedWith( UniqueAnnotations.create() ).toInstance(
new ActionHandlerMapImpl<A, R>( actionClass,
handlerClass ) );
}

I was wondering why the : 'annotatedWith(UniqueAnnotations.create())'
is used ?
Is that to prevent accidental injection ?
It looks like it would work without this annotatedWith also, or am I
missing something here?

thanks Joost

joost

unread,
Dec 16, 2011, 4:48:10 AM12/16/11
to GWT Dispatch
I figured it out,
I guess it is just for having unique bindings that this random
annotation was added

David Peterson

unread,
Dec 16, 2011, 6:57:52 AM12/16/11
to gwt-di...@googlegroups.com
Hmm, yeah, probably. There was a good reason for it back in the day. I think it was to guarantee that each binding would be unique and all the ActionHandlerMap instances would be loaded. But I'm a bit rusty on this stuff…

David


On Friday, 16 December 2011 at 7:48 PM, joost wrote:

> I figured it out,
> I guess it is just for having unique bindings that this random
> annotation was added
>

Reply all
Reply to author
Forward
0 new messages