Re: Can I Inject x Class?

2018-06-21 Thread Joe DeSantis
The method that was used prior was: injector.getExistingBinding(key)).
isPresent()
It did accurately identify all explicit bindings, however it did not work 
with just-in-time bindings.


On Thursday, June 21, 2018 at 9:59:59 AM UTC-4, Luke Sandberg wrote:
>
> Injector.getBinding is probably the right method
> On Wed, Jun 20, 2018 at 11:51 PM Stephan Classen  > wrote:
>
>> 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...@googlegroups.com .
>> To post to this group, send email to google...@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
>>  
>> 
>> .
>> 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...@googlegroups.com .
>> To post to this group, send email to google...@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.
>>
>

-- 
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/8fc1fe40-8b87-4985-a2c3-680707754cac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Can I Inject x Class?

2018-06-21 Thread Luke Sandberg
Injector.getBinding is probably the right method
On Wed, Jun 20, 2018 at 11:51 PM Stephan Classen  wrote:

> 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.
> 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/dbbc0674-7e82-47de-97ee-6bdf9258d2fd%40googlegroups.com
> 
> .
> 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.
>

-- 
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/CAO9V1MJbM8TpBj8k38Fhn4%3DgTUq8gWxhfaPKP5%3D4-23VgOW6wg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Can I Inject x Class?

2018-06-21 Thread Stephan Classen
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 
.
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/dbbc0674-7e82-47de-97ee-6bdf9258d2fd%40googlegroups.com 
.

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.


Can I Inject x Class?

2018-06-20 Thread Joe DeSantis
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.
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/dbbc0674-7e82-47de-97ee-6bdf9258d2fd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.