>>Otherwise InjectionPoint#isDelegate() would always return
false
No, Decorators are also beans and you can get its injection points with
getInjectionPoints that one of them is @delegate therefore isDelegate returns true.
I think that "InjectionPoint injection" in the spec. has never written for that
DependentScoped beans are injected into decorator delegates.
Thanks;
--Gurkan
________________________________
From: Sven Linstaedt <sven.linstaedt(a)googlemail.com>
To: Pete Muir <pmuir(a)redhat.com>
Cc: Weld-Dev List <weld-dev(a)lists.jboss.org>
Sent: Fri, April 9, 2010 12:16:46 PM
Subject: Re: [weld-dev] Spec clarification needed
According to the java docs, I would also suppose your expression to be true. Otherwise
InjectionPoint#isDelegate() would always return false, making this method dispensable. The
interesting point imho is injecting the InjectionPoint in other cases than producer
methods. I have not seen examples for this usage in the spec.
br, Sven
2010/4/9 Pete Muir <pmuir(a)redhat.com>
Given these beans and decorators (enabled)
>interface Animal {
> String hello();
>}
>class Cat implements Animal {
> @Inject private InjectionPoint injectionPoint;
> public String hello() {
> return "hello";
> }
> public InjectionPoint getInjectionPoint() {
> return injectionPoint;
> }
>}
>@Decorator
>class AnimalDecorator implements Animal {
> @Inject @Delegate
> private Animal bean;
> public String hello() {
> return bean.hello() + " world!";
> }
>}
>class Cattery {
> @Inject Cat cat;
> Cat getCat() {
> return cat;
> }
>}
>Should
>cattery.getCat().getInjectionPoint().isDelegate() return true or false?
>I believe it should return true, as Cat is being decorated, and hence injected into
the decorator delegate injection point.
>Ref is
https://jira.jboss.org/jira/browse/CDITCK-138
>_______________________________________________
>weld-dev mailing list
weld-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/weld-dev
___________________________________________________________________
Yahoo! Türkiye açıldı!
http://yahoo.com.tr
İnternet üzerindeki en iyi içeriği Yahoo! Türkiye sizlere sunuyor!