Hi, thank you for the help so far in using guice.
I would like to make the following repetitive binding scenario easier:
bind(new TypeLiteral<ICache<MapLocation>>(){}).to(new
TypeLiteral<Cache<MapLocation>>(){}).in(Singleton.class);
bind(new TypeLiteral<ICache<Npc>>(){}).to(new
TypeLiteral<Cache<Npc>>(){}).in(Singleton.class);
bind(new TypeLiteral<ICache<CannedChat>>(){}).to(new
TypeLiteral<Cache<CannedChat>>(){}).in(Singleton.class);
For the 3 classes (MapLocation, Npc, CannedChat) above it is not a big
deal to manually bind it.
However, I need to do this for 56 more classes, and then again for
another interface and its generic implementation.
Manually binding this way is error-prone, tedious, and bloated.
To avoid code bloat, I'd rather use reflection to perform the binding
over a list of classes (since it is my understanding that I can't
simply get a list of classes in a package like you can in C#).
Does anyone know how this can be done in Java? Thanks
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---