[cdi-dev] Clarification for manually resolving 'Instance'

Arne Limburg arne.limburg at openknowledge.de
Sun Sep 25 16:18:45 EDT 2011


Hi Pete,

Obviously the current implementations (at least Weld and OpenWebBeans) need special handling for this case. From a user perspective it would be convenient to be able to do a beanManager.getBeans(Instance.class). That is the only way currently to list all available Beans, which is needed from time to time. Since I am always a fan of seeing things from the users perspective, so why not specifying this?

Cheers,
Arne

-----Ursprüngliche Nachricht-----
Von: Pete Muir [mailto:pmuir at redhat.com] 
Gesendet: Sonntag, 25. September 2011 22:13
An: Arne Limburg
Cc: Mark Struberg; cdi-dev at lists.jboss.org
Betreff: Re: AW: [cdi-dev] Clarification for manually resolving 'Instance'

Right, this is the obvious solution, (well actually we would specify that a bean is registered for Instance as well as Instance<X> rather than fiddle with the resolution rules). I'm not sure if there any problems right now ;-)

On 25 Sep 2011, at 21:11, Arne Limburg wrote:

> Hi,
> 
> wouldn't be so hard to specify that 
> beanManager.getBeans(Instance.class); is the same as 
> beanManager.getBeans(new TypeLiteral<Instance<Object>>() 
> {}.getType());
> 
> Cheers,
> Arne
> 
> --
> 
> Arne Limburg - Enterprise Architekt
> open knowledge GmbH, Oldenburg
> Bismarckstraße 13, 26122 Oldenburg
> Mobil: +49 (0) 151 108 22 942
> Tel: +49 (0) 441 - 4082-0
> Fax: +49 (0) 441 - 4082-111
> arne.limburg at openknowledge.de
> http://www.openknowledge.de
> 
> Registergericht: Amtsgericht Oldenburg, HRB 4670
> Geschäftsführer: Lars Röwekamp, Jens Schumann
> 
> 
> -----Ursprüngliche Nachricht-----
> Von: cdi-dev-bounces at lists.jboss.org 
> [mailto:cdi-dev-bounces at lists.jboss.org] Im Auftrag von Pete Muir
> Gesendet: Sonntag, 25. September 2011 22:08
> An: Mark Struberg
> Cc: cdi-dev at lists.jboss.org
> Betreff: Re: [cdi-dev] Clarification for manually resolving 'Instance'
> 
> 
> On 25 Sep 2011, at 21:06, Mark Struberg wrote:
> 
>>> The parameterized type resolution rules are correct, it's just there 
>>> is no raw type of Instance to resolve.
>> 
>> 
>> Yes, I think too, but was not sure if everyone do see it that way.
> 
> Ok, so until I actually see someone make a specific comment, I think 
> we can leave this alone :-)
> 
>> 
>> 
>>> Should there be? Not sure if it would just be more confusing?
>> 
>> I already saw the usage of Instance.class without the TypeLiteral (which is pretty well hidden in the specs).
>> And people wondered why that doesn't work ...
> 
> Ok, file an issue, we can think about how to improve this.
> _______________________________________________
> cdi-dev mailing list
> cdi-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/cdi-dev




More information about the cdi-dev mailing list