[webbeans-dev] Replacement pattern for Manager.getInstanceByType

Gavin King gavin.king at gmail.com
Wed May 27 15:55:25 EDT 2009


I don't understand what you would be wanting to do this yourself all
over the place.

Why on earth are you going to be performing typesafe resolution
manually yourself instead of letting 299 do the injection?!

What is the usecase for this? Why do you do typesafe resolution at
anything other than an injection point?

On Wed, May 27, 2009 at 1:15 AM, David Allen <drallendc at gmail.com> wrote:
> On Tue, 2009-05-26 at 20:42 -0500, Clint Popetz wrote:
>> >From what I can tell, code that used to do:
>>
>>    manager.getInstanceByType(clazz)
>>
>> now need to do:
>>
>>
>> manager.getReference(manager.getBeans(clazz).iterator().next(),clazz);
>>
>> (plus checking that the set contains only one element and throwing an
>> exception if not.)
>
> Yes, this is the first case I mentioned earlier that I postponed
> yesterday.  This is a drastic API difference that does affect many of
> the other projects too.
>
> For the TCK, I was thinking of just adding the corresponding behavior
> into the abstract test class we use so that the changes are localized to
> a single line of code (each call to getInstanceByType).
>
> Outside of the TCK, I am not sure how much it is used.  And since there
> will be less of a framework involved in some cases, many instances of
> the call will need to be replaced with a number of lines of code (a lot
> of duplicate code as you mentioned above).
>
>>
>> Is that really true?  Is there no more direct way to obtain this in
>> the SPI?  It seems like a pretty common case.  If not, I can have a
>> utility method to do the above in the core, as many things don't cast
>> to ManagerImpl, so I'd rather not put it there.
>>
>> -Clint
>>
>>
>> --
>> Clint Popetz
>> http://42lines.net
>> Scalable Web Application Development
>> _______________________________________________
>> webbeans-dev mailing list
>> webbeans-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/webbeans-dev
>
> _______________________________________________
> webbeans-dev mailing list
> webbeans-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/webbeans-dev
>



-- 
Gavin King
gavin.king at gmail.com
http://in.relation.to/Bloggers/Gavin
http://hibernate.org
http://seamframework.org




More information about the weld-dev mailing list