Is the question basically how to know whether to take an action when
.createReportCollection() is called, because you don't know whether
.annotatedWith() will be called or not?

On Tue, Mar 29, 2016 at 2:07 PM, Stephan Classen <[email protected]> wrote:

> OK, I read you post several times still I am not 100% sure if I understood
> your problem entirely.
> Maybe some more code or concrete examples would be helpful...
>
> From what I think you are trying to achieve I have done something similar
> myself once before.
> Have a look at the following classes:
> - PersistenceModule [1]
> - PersistenceUnitModuleConfiguration [2]
> - PersistenceUnitModule [3]
>
> An example of the usage of above classes can be found here [4].
>
> The idea behind my approach is that the PersistenceModule holds the EDSL
> (bunch of protected methods).
> The EDSL methods store the configuration in the
> PersistenceUnitModuleConfiguration. When the injector is created the
> PersistenceUnitModuleConfigurations are used to create
> PersistenceUnitModules (see PersistenceModule. configurePersistenceUnits).
> The PersistenceUnitModule will add the bindings to the injector.
>
> I hope I am not totally off topic with my response.
>
> Cheers
>
>
> [1]
> https://svn.apache.org/viewvc/onami/tags/org.apache.onami.persist-1.0.1/src/main/java/org/apache/onami/persist/PersistenceModule.java?revision=1633051&view=markup
> [2]
> https://svn.apache.org/viewvc/onami/tags/org.apache.onami.persist-1.0.1/src/main/java/org/apache/onami/persist/PersistenceUnitModuleConfiguration.java?revision=1633051&view=markup
> [3]
> https://svn.apache.org/viewvc/onami/tags/org.apache.onami.persist-1.0.1/src/main/java/org/apache/onami/persist/PersistenceUnitModule.java?revision=1633051&view=markup
> [4] http://onami.apache.org/persist/complexWebApp.html
>
>
> On 29.03.2016 21:16, John Gardiner Myers wrote:
>
> I am attempting to implement some auxiliary EDSLs for accessing a library
> through Guice. I am having trouble figuring out how to implement
> .annotatedWith() in situations where the caller doesn't have to specify an
> implementation.
>
> This is easy enough to do when the library needs to consume a mapping--one
> can have
>
>     reportBinder(binder).export(SomeClass.class);
>
> throw into a multibinder a package local Mapping object containing a field
> with Key.get(SomeClass.class) and defaults for other fields, then
> .annotatedWith(...) can later replace that injection key field. Other EDSL
> methods can later replace other fields to have non-default values. So a
> caller could do:
>
> reportBinder(binder).export(SomeClass.class).annotatedWith(SomeAnnotation.class).withTags(whatever);
>
>
> What I can't figure out how to implement is the situation where I need the
> EDSL to create a new binding.
>
> reportBinder(binder).createReportCollection(SomeInterface.class);
>
> needs to bind Key.get(SomeInterface.class) to some default implementation
> the library constructs, but
>
> reportBinder(binder).createReportCollection(SomeInterface.class).annotatedWith(SomeAnnotation.class);
>
>
> needs to bind Key.get(SomeInterface.class, SomeAnnotation.class) to a
> default implementation, but not provide any binding for
> Key.get(SomeInterface.class).
>
> Any suggestions for how to accomplish this?
>
>
> --
> 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/56FAEE8F.1040203%40gmx.ch
> <https://groups.google.com/d/msgid/google-guice/56FAEE8F.1040203%40gmx.ch?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAKCukA%2BgYxw-4o8sNwAuotohgsk87FUezyE-ze6BB00zPVnZDw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to