I think I'd need to see more of what you are trying to do - if you're really mapping T's to H's then there has to be some place that the mapping is maintained. You could create a custom module that registers a Provider of HX for TX for all available T/Hs. But it would have to scan (presumably) for T/s and H/s and that can be performance affecting.

The more automatic your discovery is, the more issues you can potentially have with things sort of getting a bit inobvious, and possibly negative for performance. Just be balanced and consider the trade-offs.

Christian.


On 8 Dec 2012, at 11:11, paweł kamiński wrote:

hey, I ve already answered my own question few hours ago , so I guess it
waits for moderation.
yes multibinding is a way to go, is there a way to automatically configure
it so I dont need to add all H* classes by hand?

thanks anyway.

On Saturday, December 8, 2012 4:56:54 PM UTC+1, Christian Gruber wrote:

You might want to look at MapBinder.

On Friday, 7 December 2012, paweł kamiński wrote:

<http://stackoverflow.com/questions/13670060/guice-return-set-of-instances-with-custom-annotation#>

I have very simple scenario where class A registers instances for types.

A.register(T1.class, new H1());
A.register(T2.class, new H2());

this is fairly simple configuration when done by hand but guice injection
doesn't work when I create instances outside the guice framework.

I try to figure out how to create and configure A with all instance with
custom annotation using guice. is guice even prepared for that?

I know that in java it is possible to use
javax.enterprise.inject.Instance to get all instances of type (and
optionally annotated with custom annotation) but I dont want to use this if
possible.

thanks for any help

--
You received this message because you are subscribed to the Google Groups
"google-guice" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-guice/-/sAMvg3woPCUJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-guice?hl=en.



--
You received this message because you are subscribed to the Google Groups "google-guice" group. To view this discussion on the web visit https://groups.google.com/d/msg/google-guice/-/-jbVt_5a8sgJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-guice?hl=en.

--
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-guice?hl=en.

Reply via email to