It works if I make out-of-order calls to the Guice binding EDSL methods:

public class ReportCollectionBinder<T>
{
    private final ReportCollectionProvider<T> provider;
    private final AnnotatedBindingBuilder<T> bindingBuilder;

    ReportCollectionBinder(Binder binder, Class<T> iface)
    {
        provider = new ReportCollectionProvider<>(iface);
        bindingBuilder = binder.bind(iface);
        bindingBuilder.toProvider(provider).in(SINGLETON);
    }

    public NamedReportCollectionBinder<T> annotatedWith(Annotation 
annotation)
    {
        bindingBuilder.annotatedWith(annotation);
        return new NamedReportCollectionBinder<>(provider);
    }
}

This usage pattern isn't documented, though, and it's not clear whether it 
might break in a future version of Guice.


-- 
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 [email protected].
To post to this group, send email to [email protected].
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/479f593f-8c9c-456a-bfa0-873c23b694b0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to