Hi guys,

I'm kind of a newbie so I hope I won't made anyone mad on me if the
question is too silly :)

The problem is the following:

class Foo {
  private boolean bar;
  @Inject
  public Foo(boolean bar) {...}

  public doIt() {
    if(bar) { goForIt();}
    else { abortNow();}
  }
}

I want guice to create instances of Foo that sometimes have the 'bar'
member set to true and other times it should be set to false. Ideally,
I would be using it like this:

class Bar {
  @Inject
  public Bar(@TrueBar Foo foo) {
    //here Foo.bar should be set to true
  }
}

class Baz {
  @Inject
  public Bar(Foo foo) {
    //here Foo.bar should be set to false
  }
}

How can I achieve this? (if the annotation is not necessary or there
is a better way to code this I'm open to suggestions ;)

Thanks a lot.

Cheers,
  Mirco

-- 
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.

Reply via email to