On Fri, Apr 29, 2011 at 12:30 PM, [email protected] <[email protected]> wrote: > How can i pass "this" parameter of domain to node object that should > be created by guice?
I thought you were saying that the DomainManager created the Domain objects. I see now that you have Guice creating them. Use an Injected Factory pattern. It's currently the 3rd question in the FAQ: http://code.google.com/p/google-guice/wiki/FrequentlyAskedQuestions You Inject the Factory for guice-supplied parameters then call your own make method in the Factory with whatever other parameters the Domain objects need such as "this" from the DomainManager. > > On Apr 30, 12:49 am, Chad Urso McDaniel <[email protected]> wrote: >> On Thu, Apr 28, 2011 at 11:57 PM, [email protected] >> >> <[email protected]> wrote: >> > Hi! Sry for my english. I have next problem.. I have three entities >> > DomainManager, Domain and Node. DomainManager is singleton that able >> > to create list of Domain objects. Each Domain can create list of Node >> > objects: >> >> > DomainManager 1<>-----* Domain 1<>----* Node >> >> If a DomainManager is creating Domain objects it would be simplest to >> have the DomainManager pass "this" directly during creation. Same with >> Domain creating Node objects. >> >> >> >> >> >> >> >> >> >> >> >> > I want: >> >> > 1. Node implementation can inject corresponding parent Domain to >> > himself. >> > 2. Node implementation can inject Domain manager instance too. >> >> > class NodeImpl { >> > @Inject >> > NodeImpl(Domain parentDomain, DomainManager domainManager) { >> >> > } >> > } >> >> > How can i do this? >> >> > -- >> > 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 >> > athttp://groups.google.com/group/google-guice?hl=en. >> >> -- >> want to chat with me?http://tinyurl.com/5u3ohp > > -- > 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. > > -- want to chat with me? http://tinyurl.com/5u3ohp -- 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.
