On Aug 14, 12:17 pm, "Robbie Vanbrabant" <robbie.vanbrab...@gmail.com>
wrote:
Ouch, that's ugly. How about arrays? Is that supported? Like Service[]
services;?
On Aug 14, 12:17 pm, "Robbie Vanbrabant" < robbie.vanbrab...@gmail.com>
wrote:
On Aug 14, 12:37 pm, "Robbie Vanbrabant" <robbie.vanbrab...@gmail.com>
wrote:
> That would get rid of the TypeLiteral stuff. But if you use the issue 123
> factory method it's basically the same.
> Depending on when or why you need the list of classes, you could perhaps
> also use AOP. What's the use case?
>
> Robbie
>
On Aug 14, 12:37 pm, "Robbie Vanbrabant" <robbie.vanbrab...@gmail.com>
wrote:
> That would get rid of the TypeLiteral stuff. But if you use the issue 123
> factory method it's basically the same.
> Depending on when or why you need the list of classes, you could perhaps
> also use AOP. What's the use case?
>
> Robbie
>
public interface Controller
{
public void registerService(Service service);
...
}
public class MyService implements Service
{
@Inject
public void init(Controller controller)
{
controller.registerService(this);
}
...
}
I just typed that up so it might be off a bit, but something like it
ought to accomplish what you're looking for.
On 8/14/07, Justin <rize...@gmail.com> wrote:
>
--
Gregory Kick
http://kickstyle.net/
I may just use Pico, as I'm wanting more the just DI. I was using it
before, but decided to give Guice a spin.
On Aug 14, 12:37 pm, "Robbie Vanbrabant" <robbie.vanbrab...@gmail.com>
wrote:
> That would get rid of the TypeLiteral stuff. But if you use the issue 123
> factory method it's basically the same.
> Depending on when or why you need the list of classes, you could perhaps
> also use AOP. What's the use case?
>
> Robbie
>
> On 8/14/07, Justin < rizen...@gmail.com> wrote:
>
>
>
> > Ouch, that's ugly. How about arrays? Is that supported? Like Service[]
> > services;?
>
> > On Aug 14, 12:17 pm, "Robbie Vanbrabant" < robbie.vanbrab...@gmail.com>
> > wrote:
> > > Here's how you can inject collections in 1.0:
>
> > > public class MultiValue {
> > > public MultiValue(int i) {
> > > System.out.println(i);
> > > }
> > > public static void main(String[] args) {
> > > Injector i = Guice.createInjector (new Module() {
On Aug 14, 1:00 pm, "Robbie Vanbrabant" <robbie.vanbrab...@gmail.com>
wrote:
> Is it perhaps this what you need?http://www.picocontainer.org/lifecycle.html
> Like, lifecycle callbacks for objects constructed by the container. At least
> if I understand that document correctly, I didn't read the whole thing.
>
> On 8/14/07, Justin <rizen...@gmail.com> wrote:
>
>
>
> > I may just use Pico, as I'm wanting more the just DI. I was using it
> > before, but decided to give Guice a spin.
>
> > On Aug 14, 12:37 pm, "Robbie Vanbrabant" <robbie.vanbrab...@gmail.com>
> > wrote:
> > > That would get rid of the TypeLiteral stuff. But if you use the issue
> > 123
> > > factory method it's basically the same.
> > > Depending on when or why you need the list of classes, you could perhaps
> > > also use AOP. What's the use case?
>
> > > Robbie
>
> > > On 8/14/07, Justin <rizen...@gmail.com> wrote:
>
> > > > Ouch, that's ugly. How about arrays? Is that supported? Like Service[]
> > > > services;?
>
> > > > On Aug 14, 12:17 pm, "Robbie Vanbrabant" <robbie.vanbrab...@gmail.com>
> > > > wrote:
> > > > > Here's how you can inject collections in 1.0:
>
> > > > > public class MultiValue {
> > > > > public MultiValue(int i) {
> > > > > System.out.println(i);
> > > > > }
> > > > > public static void main(String[] args) {
> > > > > Injector i = Guice.createInjector(new Module() {
On Aug 14, 1:08 pm, "Robbie Vanbrabant" <robbie.vanbrab...@gmail.com>
wrote:
> In any case Guice currently doesn't support lifecycle callbacks. Gregory's
> suggestion is certainly worth considering.
>
> Robbie
>
> On 8/14/07, Robbie Vanbrabant <robbie.vanbrab...@gmail.com> wrote:
>
>
>
> > Is it perhaps this what you need?
> >http://www.picocontainer.org/lifecycle.html
> > Like, lifecycle callbacks for objects constructed by the container. At
> > least if I understand that document correctly, I didn't read the whole
> > thing.
>