I'm trying to use Guice to instantiate my Objectify DAOs. My hierarchy is the following:public class EmpresaDao extends ObjectifyDao<Empresa> { ... }public class ObjectifyDao<T> extends DAOBase { ... }When I use "new EmpresaDao()", getClass().getGenericSuperclass() gives me:[INFO] superclass -> br.com.xxxxx.server.service.ObjectifyDao<br.com.xxxxx.domain.Empresa>When I use "injector.getInstance(EmpresaDao.class)", getClass().getGenericSuperclass() gives me:[INFO] superclass -> class br.com.xxxx.server.service.EmpresaDaoObviously, I want to let Guice instantiate my objects with DI.Can someone explain why this is happen?
Is there any way (instantiating with Guice) to get the same superclass as with new().Thanks.--
You received this message because you are subscribed to the Google Groups "google-guice" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-guice/-/nD9OpdD__GEJ.
To post to this group, send email to google...@googlegroups.com.
To unsubscribe from this group, send email to google-guice...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-guice?hl=en.
Thanks Stuart.I've tried to disable circular proxies this way and got same results.
Is this the right way??new ServletModule() {@Overrideprotected void configureServlets() {binder().disableCircularProxies();...bind(EmpresaDao.class).in(RequestScoped.class)[INFO] new()[INFO] class -> class br.com.noxxonsat.server.service.EmpresaDao[INFO] superclass -> br.com.noxxonsat.server.service.ObjectifyDao<br.com.noxxonsat.domain.Empresa>[INFO] Guice[INFO] class -> class br.com.noxxonsat.server.service.EmpresaDao$$EnhancerByGuice$$12c0765f[INFO] superclass -> class br.com.noxxonsat.server.service.EmpresaDao
To unsubscribe from this group, send email to google-guice+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-guice?hl=en.
--
You received this message because you are subscribed to the Google Groups "google-guice" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-guice/-/c9TFlVtmfI0J.
This is related to an example posted by David Chandler using RequestFactory (GWT) and Objectify.getGenericSuperclass() is used here ir order to get the business object which the DAO manipulates. I noticed in debugger that inside guiceObj.getGenericSuperclass() there is a "genericInfo" field which contains the business object. Do you know how can I access it?
public class ObjectifyDao<T> extends DAOBase
{static final int BAD_MODIFIERS = Modifier.FINAL | Modifier.STATIC| Modifier.TRANSIENT;static{ObjectifyService.register(NamedList.class);ObjectifyService.register(AppUser.class);}protected Class<T> clazz;public ObjectifyDao(){Type genericSuperclass = getClass().getGenericSuperclass();// Allow this class to be safely instantiated with or without a parameterized typeif (genericSuperclass instanceof ParameterizedType)clazz = (Class<T>) ((ParameterizedType) genericSuperclass).getActualTypeArguments()[0];
To view this discussion on the web visit https://groups.google.com/d/msg/google-guice/-/NOphc8tGH8IJ.