Re: Injection of context in a @Provides method ?

2014-03-10 Thread Mikkel Petersen
This sounds like a good idea but wont to get a Already bound exception ? Den mandag den 10. marts 2014 20.26.26 UTC+1 skrev Nate Bauernfeind: Just finished reading through the stack overflow link; thanks for sharing it. It reminded me of the following: I've heard/read/adopted the policy

Re: Injection of context in a @Provides method ?

2014-03-10 Thread Mikkel Petersen
. Good luck, Nate On Mon, Mar 10, 2014 at 3:15 PM, Mikkel Petersen mlp...@gmail.comjavascript: wrote: This sounds like a good idea but wont to get a Already bound exception ? Den mandag den 10. marts 2014 20.26.26 UTC+1 skrev Nate Bauernfeind: Just finished reading through the stack

Re: Injection of context in a @Provides method ?

2014-03-10 Thread Mikkel Petersen
for the injection to occur. Good luck, Nate On Mon, Mar 10, 2014 at 3:15 PM, Mikkel Petersen mlp...@gmail.comjavascript: wrote: This sounds like a good idea but wont to get a Already bound exception ? Den mandag den 10. marts 2014 20.26.26 UTC+1 skrev Nate Bauernfeind: Just finished

Re: Injection of context in a @Provides method ?

2014-03-10 Thread Mikkel Petersen
2014 22.36.27 UTC+1 skrev Mikkel Petersen: Still, since not all classes are injectable (third party) you might need to access them and populate them manually.. Den mandag den 10. marts 2014 21.27.38 UTC+1 skrev Nate Bauernfeind: No actually you don't get already bound exceptions. Guice actually

Re: Injection of context in a @Provides method ?

2014-03-10 Thread Mikkel Petersen
. sam On Mon, Mar 10, 2014 at 6:11 PM, Mikkel Petersen mlp...@gmail.comjavascript: wrote: in case anyone has the same problem..this is my solution so far (a real world example) class WorldPhysXModule extends Module { val world: WorldPhysX = new WorldPhysX @Provides @Singleton

Re: Injection of context in a @Provides method ?

2014-03-10 Thread Mikkel Petersen
you need to request injection on the binder... it seems out of place from my experience. Nate On Mon, Mar 10, 2014 at 5:11 PM, Mikkel Petersen mlp...@gmail.comjavascript: wrote: in case anyone has the same problem..this is my solution so far (a real world example) class

Re: Injection of context in a @Provides method ?

2014-03-10 Thread Mikkel Petersen
PM, Mikkel Petersen mlp2...@gmail.comwrote: in case anyone has the same problem..this is my solution so far (a real world example) class WorldPhysXModule extends Module { val world: WorldPhysX = new WorldPhysX @Provides @Singleton @Named(dimensionScale) def dimensionScale(settings

Re: Injection of context in a @Provides method ?

2014-03-10 Thread Mikkel Petersen
on it; since that should be a no-op. I also don't think you need to request injection on the binder... it seems out of place from my experience. Nate On Mon, Mar 10, 2014 at 5:11 PM, Mikkel Petersen mlp...@gmail.comjavascript: wrote: in case anyone has the same problem..this is my

Re: Injection of context in a @Provides method ?

2014-03-10 Thread Mikkel Petersen
/4844101/how-to-inject-things-on-objects-that-were-created-using-reflection . sam On Mon, Mar 10, 2014 at 6:37 PM, Mikkel Petersen mlp2...@gmail.comwrote: Im not sure what you mean could you post a small example ? Den mandag den 10. marts 2014 23.28.52 UTC+1 skrev Sam Berlin: FYI, injecting

Re: Injection of context in a @Provides method ?

2014-03-09 Thread Mikkel Petersen
, but a sincere recommendation of a more fruitful course of action. regards, Christian. On 8 Mar 2014, at 22:37, Mikkel Petersen wrote: Too bad this has to be unresolved. Google ignores it, for some weird reason. Christian Gruber :: Google, Inc. :: Java Core Libraries :: Dependency Injection

Re: Injection of context in a @Provides method ?

2014-03-08 Thread Mikkel Petersen
(or searching for existing questions/answers). I suspect you'll find that things will become a lot simpler. sam On Mar 7, 2014 7:33 PM, Mikkel Petersen mlp...@gmail.com javascript: wrote: It's hard for me to describe the entire problem..I was really just looking for a solution to this, now

Re: Injection of context in a @Provides method ?

2014-03-08 Thread Mikkel Petersen
Btw, Multibindings doesnt solve this..but I'm glad that you told me I do things wrong, without telling me why, and without providing an alternative solution. Did you even look at the sample ? Den lørdag den 8. marts 2014 15.51.21 UTC+1 skrev Mikkel Petersen: Are you suggestion I should google

Re: Injection of context in a @Provides method ?

2014-03-08 Thread Mikkel Petersen
, I'm not sure I can help much more, though others on this list may be able to. sam On Sat, Mar 8, 2014 at 9:54 AM, Mikkel Petersen mlp...@gmail.comjavascript: wrote: Btw, Multibindings doesnt solve this..but I'm glad that you told me I do things wrong, without telling me why

Re: Injection of context in a @Provides method ?

2014-03-08 Thread Mikkel Petersen
, Mikkel Petersen mlp...@gmail.com javascript: wrote: Well multiibindings solves, in a way, the listener problem. Because it works on sets. But it doesnt solve if I wanted to access other objects from other modules. If you could care to explain to me why this is wrong without saying its just

Re: Injection of context in a @Provides method ?

2014-03-08 Thread Mikkel Petersen
Also, the modules that configures the module might grow in complexity..then what ? make another module that configures the module that configures the module ? Den lørdag den 8. marts 2014 22.19.35 UTC+1 skrev Mikkel Petersen: Yes, but project was started before eventbus existed. Stil, I

Re: Injection of context in a @Provides method ?

2014-03-08 Thread Mikkel Petersen
files with me, out of thread, I'd be happy to see if there are even better and more concrete suggestions I can give you. Nate On Mar 8, 2014 9:02 AM, Mikkel Petersen mlp...@gmail.com javascript: wrote: Well multiibindings solves, in a way, the listener problem. Because it works on sets

Re: Injection of context in a @Provides method ?

2014-03-08 Thread Mikkel Petersen
Too bad this has to be unresolved. Google ignores it, for some weird reason. On Sat, Mar 8, 2014 at 10:34 PM, Mikkel Petersen mlp2...@gmail.com wrote: Theres a thread about it in Stackoverflow. http://stackoverflow.com/questions/5504555/guice-is-it-possible-to-inject-modules Den lørdag

Injection of context in a @Provides method ?

2014-03-07 Thread Mikkel Petersen
Hello all I have a slight problem with guice injection when using a method annotated with @Provides example : @Provides public Service someService() { return new SomeService() } I would like to get the current context injected in SomeService..I don't understand why Guice doesn't do that

Re: Injection of context in a @Provides method ?

2014-03-07 Thread Mikkel Petersen
you from using a normal .to binding? bind(SomeService.class).to(SomeService.class) Nate On Fri, Mar 7, 2014 at 4:13 PM, Mikkel Petersen mlp...@gmail.comjavascript: wrote: Hello all I have a slight problem with guice injection when using a method annotated with @Provides example

Re: Injection of context in a @Provides method ?

2014-03-07 Thread Mikkel Petersen
, Mar 7, 2014 at 4:44 PM, Mikkel Petersen mlp...@gmail.comjavascript: wrote: Because I want to receive other bindings: public Service someService(@Inject Settings settings) { SomeService s = new SomeService(settings.getHost()) inj.injectMembers(s) return s } Den fredag den 7

Re: Injection of context in a @Provides method ?

2014-03-07 Thread Mikkel Petersen
. Then I can easily either inject the configuration class privately for that sub-portion of my application, or do whatever I need to with it (like configure an http client in a @Provides method). Happy Guicing! On Fri, Mar 7, 2014 at 5:00 PM, Mikkel Petersen mlp...@gmail.comjavascript

Re: Injection of context in a @Provides method ?

2014-03-07 Thread Mikkel Petersen
was removed. On Fri, Mar 7, 2014 at 5:16 PM, Mikkel Petersen mlp...@gmail.comjavascript: wrote: Thank you all for your responses ! Problem is, my application has grown to the point that even the modules themselves have becoming an application. So there are many objects created in different

Binding single instance to different keys

2008-12-02 Thread Mikkel Petersen
If I have class Person implements Action,Worker,Role { ... } and public void configure() { Person person = new Person; // bind(Person.class).toInstance(person); bind(Role.class).toInstace(person); bind(Worker.class).toInstace(person); } I get this error : Exception in

Re: Expose (private modules)

2008-12-01 Thread Mikkel Petersen
Dec., 01:59, Mikkel Petersen [EMAIL PROTECTED] wrote: Oh, sorry, didnt see, you explained that in your first answer. On Dec 1, 1:58 am, Mikkel Petersen [EMAIL PROTECTED] wrote: Ok, why do we have to do this, is it some kind of workaround because something better is not possible ? To me it's

Expose (private modules)

2008-11-30 Thread Mikkel Petersen
I was thinking that the current notation : public void configurePrivateBindings() { super.configurePrivateBindings();expose (MovingRagdoll.class).annotatedWith(Names.named(boxer1)); } --~--~-~--~~~---~--~~ You received this message because you

Re: Expose (private modules)

2008-11-30 Thread Mikkel Petersen
Ok, why do we have to do this, is it some kind of workaround because something better is not possible ? To me it's confusing and somehow don't mix in well with the original bind() method. I think ideally expose() should just work like bind(), so you can do things like expose

Re: Expose (private modules)

2008-11-30 Thread Mikkel Petersen
Oh, sorry, didnt see, you explained that in your first answer. On Dec 1, 1:58 am, Mikkel Petersen [EMAIL PROTECTED] wrote: Ok, why do we have to do this, is it some kind of workaround because something better is not possible ? To me it's confusing and somehow don't mix in well

Re: Announcing Injector.createChildInjector

2008-10-24 Thread Mikkel Petersen
Ok just tried it and it works fine. So great !.. On Oct 24, 12:05 am, Mikkel Petersen [EMAIL PROTECTED] wrote: Thats IT ! I see it in svn, is it working now ? On Oct 23, 11:28 pm, Robbie Vanbrabant [EMAIL PROTECTED] wrote: On Thu, Oct 23, 2008 at 11:18 PM, Mikkel Petersen [EMAIL PROTECTED

Re: Announcing Injector.createChildInjector

2008-10-23 Thread Mikkel Petersen
Thats IT ! I see it in svn, is it working now ? On Oct 23, 11:28 pm, Robbie Vanbrabant [EMAIL PROTECTED] wrote: On Thu, Oct 23, 2008 at 11:18 PM, Mikkel Petersen [EMAIL PROTECTED] wrote: I took a look at it and I still don't feel that it solves this problem that I described in another post

How to bind locally ?

2008-09-08 Thread Mikkel Petersen
I dont know if this makes sense, but there seems to be a problem when you need multiple instances of the same object, created using the same modules. For example: you have the mainmodule and the sub module will create the same kind of object, only with a slight difference. They will bind to

Re: How to bind locally ?

2008-09-08 Thread Mikkel Petersen
. On 8 Sep., 22:55, Logan Johnson [EMAIL PROTECTED] wrote: What do you want to happen here? One Phone that's shared among your Person instances, or each Person gets its own Phone, or something entirely different? On Mon, Sep 8, 2008 at 4:48 PM, Mikkel Petersen [EMAIL PROTECTED] wrote: I dont

A very simple question

2008-09-08 Thread Mikkel Petersen
What is Guice SPI ? is it the same as Guice 2.0 or is it something else ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups google-guice group. To post to this group, send email to google-guice@googlegroups.com To