Jukito takes another approach. They use an ElementVisitor to collect all
bindings and then decide if the required binding is in the module(s).
Have a look at the BindingsCollector.java class
https://github.com/ArcBees/Jukito/blob/master/jukito/src/main/java/org/jukito/BindingsCollector.java
On 20.06.2018 22:45, Joe DeSantis wrote:
I was working with a JUnit 5 extension for Guice, and we had the need
to determine if a particular class was able to be injected by an
injector.
The only solution we came up with is attempting to get an instance
with that Injector. (Literally calling the getInstance method, in a
try/catch block).
So my question is simply, what is the best way of determining if you
can get an instance of a particular class given an injector.
The discussion on the implementation is here for anyone who is curious,
https://github.com/JeffreyFalgout/junit5-extensions/commit/adf2f4ece977e834ba9b4f1563ebc568784ad3a4#commitcomment-29425765
Thanks!
--
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
<mailto:google-guice+unsubscr...@googlegroups.com>.
To post to this group, send email to google-guice@googlegroups.com
<mailto: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/dbbc0674-7e82-47de-97ee-6bdf9258d2fd%40googlegroups.com
<https://groups.google.com/d/msgid/google-guice/dbbc0674-7e82-47de-97ee-6bdf9258d2fd%40googlegroups.com?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 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/c98854df-a81a-7053-c32a-692dde254fc9%40gmx.ch.
For more options, visit https://groups.google.com/d/optout.