It does work, I've done it multiple times this way. It's very easy of you use args4j, you then already have a little pojo which wraps your command line arguments.
What you then need to do is: bind your settings to that one instance and let your Z depend on it. Everything else just depends on their direct dependency. On Dec 26, 2013 10:53 AM, "Maatary Okouya" <[email protected]> wrote: > Thx for the prompt answer. However I don't think that would work. > > Like I said u have A needs B needs C need Z needs cli inputs. > C needs a Z, but Z can t be constructed without inputs, which must be cli > provided. > B needs a C, but C can be constructed without a Z inputs > And so on. > And so on. > > On Thursday, December 26, 2013, Moandji Ezana wrote: > >> If everything depends on CLI input, you could wrap it in a 'settings' >> object and inject that object where needed, rather than use assisted >> injection everywhere. >> On Dec 26, 2013 3:09 AM, "Maatary Okouya" <[email protected]> >> wrote: >> >>> I'm currently using Guice in my App. However i find myself mostly using >>> assisted inject because there is a chain of injected objects that all >>> depend on what was the input of the program. >>> Hence almost everything is assisted inject. >>> >>> For instance A need B who need c who need Z which needs input from the >>> command line. In the end i feel like everything will be assisted injected. >>> So given that i'm stuck with it i want to be sure that i m using it right. >>> >>> I personally feel like writing my own factories would be as good. >>> Moreover, in addition to the same advantage i could further limit the >>> creation of my objects in question to these factories. >>> >>> Hence my question here is, how useful is it really to use assisted >>> inject, is it only the idea of having things assisted and non assisted as >>> the same time? What if like in my case you have only have assisted >>> parameters? >>> >>> Their must be some gain at organizing it with assisted injection. I just >>> don't see it. >>> >>> If anyone could enlighten me here, i would greatly i appreciate, >>> >>> May thanks >>> >>> -- >>> 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 [email protected]. >>> To post to this group, send email to [email protected]. >>> Visit this group at http://groups.google.com/group/google-guice. >>> For more options, visit https://groups.google.com/groups/opt_out. >>> >> -- >> You received this message because you are subscribed to a topic in the >> Google Groups "google-guice" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/google-guice/c9fipvWw1j8/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> [email protected]. >> To post to this group, send email to [email protected]. >> Visit this group at http://groups.google.com/group/google-guice. >> For more options, visit https://groups.google.com/groups/opt_out. >> > -- > 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 [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/google-guice. > For more options, visit https://groups.google.com/groups/opt_out. > -- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/google-guice. For more options, visit https://groups.google.com/groups/opt_out.
