Hi,
if I understand the question correctly you want Foo injected but you
will provide the importMessage yourself?
You have a few options e.g.
private Provider<Foo> foos = ...;
public createBam(String importMessage){
return new Bam(foos.get(),importMessage);
}
or similar but I'd recommend you take a look at AssistedInject
http://code.google.com/p/google-guice/wiki/AssistedInject
Cheers
Alen
On Sep 4, 3:29 pm, mcfly <[email protected]> wrote:
> forgive my misspelling... i should know java
>
> @Injectable
> public class Boom {
> public Boom (Foo foo, Bar bar) { ... }
>
> }
>
> and
> @Injectable
> public class Bam {
> public Bam(Foo foo, String importMessage) { ... }
>
> }
>
> sorry for that
>
> On 4 Sep., 14:57, mcfly <[email protected]> wrote:
>
> > Hi all,
>
> > i have a problem about the basic understanding of the injection.
>
> > If I have class:
>
> > @Injectable
> > public class Boom (Foo foo, Bar bar) { ... }
>
> > with Foo and Bar interfaces which are injected via Modules / Provider
> > etc - so far so good, I know how to handle these.
>
> > But:
>
> > @Injectable
> > public class Bam(Foo foo, String importMessage) { ... }
>
> > how do I create (or let create) instances of it ? especially if due to
> > the workflow of the application 'importMessage' can be different ?
>
> > Is this injectable - I guess via a provider - but how ?
>
> > Thanks
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---