Hi I have a generic service GenericDao<E> and all Dao's extend from it.. Now i want to get a service based on generic type. As generics are not present at runtime so I think this is very unlikely. So this is what I have done
I created another service GenericDaoFinder as public interface GenericDaoFinder { <E> GenericDaoFinder(Class<E> type); } Now in Module I contribute services to it as public static void contributeGenericDaoFinder(MappedConfiguration<Class<?>, GenericDao<?>> configuration, UserDao userDao, SomethingDao somethingDao){ configuration.add(User.class, userDao); configuration.add(Something.class, somethingDao); } Is there a better way ?? regards Taha