Robert Nicholson
2017-07-14 15:39:24 UTC
So I create an instance of a class using
injector.getInstance(Someclass.class);
this returns me an instance of Someclass
what I want is at the point of the injection for Someclass to have a
reference to "this" ie. the instance where I'm performing
the injection.
I don't want Guice to create a new object as this object already exists.
public Class A {
public createSomeclass() {
SomeModule module = new Module
return injector.getInstance(Someclass.class)
}
}
So I want the instance of Someclass to have a reference of the instance of
Class A where the inject is taking place.
So how do I do this without needing to write
someClassInstance.setClassAReference(this)
Currently Guice is not responsible for instantiating the instance of class
A.
injector.getInstance(Someclass.class);
this returns me an instance of Someclass
what I want is at the point of the injection for Someclass to have a
reference to "this" ie. the instance where I'm performing
the injection.
I don't want Guice to create a new object as this object already exists.
public Class A {
public createSomeclass() {
SomeModule module = new Module
return injector.getInstance(Someclass.class)
}
}
So I want the instance of Someclass to have a reference of the instance of
Class A where the inject is taking place.
So how do I do this without needing to write
someClassInstance.setClassAReference(this)
Currently Guice is not responsible for instantiating the instance of class
A.
--
You received this message because you are subscribed to the Google Groups "google-guice" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-guice+***@googlegroups.com.
To post to this group, send email to google-***@googlegroups.com.
Visit this group at https://groups.google.com/group/google-guice.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-guice/c123d9ee-78df-4c68-b13c-41e2c83e05e7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "google-guice" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-guice+***@googlegroups.com.
To post to this group, send email to google-***@googlegroups.com.
Visit this group at https://groups.google.com/group/google-guice.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-guice/c123d9ee-78df-4c68-b13c-41e2c83e05e7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.