Take a look at Types.newParameterizedType(Cache.class,
MapLocation.class). You can use that to create a helper method in your
module that simplifies the bind() statement.

  public void configure() {
    bindCache(MapLocation.class);
    bindCache(Npc.class);
    bindCache(CannedChat.class);
    ...
  }

  public <T> void bindCache(Class<T> cached) {
    // casts omitted
    TypeLiteral<ICache<T>> interface = TypeLiteral.get
(Types.newParameterizedType(ICache.class, cached));
    TypeLiteral<Cache<T>> implementation = TypeLiteral.get
(Types.newParameterizedType(Cache.class, cached));
    bind(interface).to(implementation);
  }

--~--~---------~--~----~------------~-------~--~----~
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