Hi, I'm trying to get guice assisted inject to help me create a nested tree 
of factories for a client api library I'm writing. The basic pattern looks 
like this:

  interface Parent {
    Child child();
    // other methods
  }

  interface Child {
    Leaf leaf(String arg);
    // other methods
  }

  class Leaf {
    @Inject Leaf(@Assisted String arg) {
      // do something with arg
    }
  }

The only place in this patterns that actually has any implementation detail 
(i.e. non-boilerplate) is the Leaf class. The rest are simple factory 
interfaces that could be implemented something like:

  class SimpleParent implements Parent {
    private final Provider<Child> childProvider;

    @Inject
    SimpleParent(Provider<Child> childProvider) {
      this.childProvider = childProvider;
    }

    @Override
    public Child child() {
      return childProvider.get();
    }
  }

As you can imagine this leads to a lot of boilerplate code.

What I would like is for guice to manage all of this for me, AssistedInject 
seems like the closest fit for what I want but isn't quite right. Is there 
anything in guice that can do what I need?

Thanks in advance.
Matt

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-guice/-/jpF6BbOUj1IJ.
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