I would like to use a builder (preferably auto-value)  with Guice. 
Guice can find constructors annotated with @Inject but those can be 
cumbersome to maintain and I would like to move to a builder pattern and 
have that be automatically found.

so the current way is like 
class ExampleA {

  ...

  @Inject
  public ExampleA(A a, B b, ...) {

  }

  ...

}

But I would like to be able to
@ProvidedBy(builder = Builder.class) // or some way to let know guice to 
know what is the thing that builds it
@AutoValue
class ExampleB {
  ...

  @AutoValue.Builder
  public abstract static class Builder {

     public abstract Builder setA(A a);

     public abstract Builder setB(B a);

     ...

     public abstract ExampleB build();
  }


}




Right now the only way i can think of how to use a builder pattern with 
Guice is to have a provides method int he module and have all the possible 
inputs injected in to the method of the provides which can still be very 
annoying to maintain

I am open to different ideas on how to link the builder and real object. 


-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-guice+unsubscr...@googlegroups.com.
To post to this group, send email to google-guice@googlegroups.com.
Visit this group at https://groups.google.com/group/google-guice.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-guice/dfa4fa02-bd0f-43ee-a225-9cbc96b3d3ce%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to