Hi List,

First: thanks for this fantastic project, it is really well designed!

One question, I have a composite object, like so

        interface A { do(); }
        
        class B implements A { do() { ... } }
        
        class CompositeA implements A {
                List<A> composites = ...
                add(A a) { composites.add(a) };
                do() {
                        for(A a : composites)
                                a.do();
                }
        }

What would be the best way to inject this?

Right know I configure it in my Module using @Provides, like so

        @Provides A provideA() {
                final CompositeA a = new CompositeA();
                a.add(new B());
                a.add(new B());
                return a;
        }

Although this works, it feels like I should be doing this differently.


Please comment,

Thanks for you time.
Jelle.

Attachment: signature.asc
Description: Digital signature

Reply via email to