> PresenceService o = (PresenceService)aClass.newInstance();
> bind(PresenceService.class).to(o.getClass());
Variable o seems unnecessary, as it is only used to get the class of
MemoryPresenceService, which you already have in variable aClass.
Instantiating the class unnecessarily may lead to bugs/performance
issues. I recommend doing this instead:
try {
Class<PresenceService> aClass = (Class<PresenceService>)
Class.forName("presence.service.MemoryPresenceService");
bind(PresenceService.class).to(aClass);
} catch (Exception e) {
....
}
--
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.