Yep.  Within the calling class (which itself was created by guice) I have

@Inject
MyClassFactory mcf;

And then when I need one...

  MyClass myObj = mcf.create("Something");


I'm unsure of whether I can do that inject within the calling method, but I 
actually need the factory in a few methods, so having it in the calling 
class makes it easy.

If it wasn't working, I'd be receiving exceptions and I'd have some missing 
on-screen elements in the application.  I haven't written a lot of unit 
tests just yet, but on the surface things look sound.


On Thursday, April 11, 2013 1:30:09 PM UTC-7, Cédric Beust ♔ wrote:
>
> On Thu, Apr 11, 2013 at 1:17 PM, Newbie McBozo <[email protected]<javascript:>
> > wrote:
>
>>
>> I still create the object with MyClassFactory.create("Something");
>>
>
> If MyClassFactory is instantiated by you and not Guice (through assisted 
> injection), then the returned object will not have its fields injected, you 
> might want to double check that.
>
> -- 
> Cédric
>
>

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to