[weld-dev] Decorator question

Gavin King gavin.king at gmail.com
Thu Dec 3 18:01:14 EST 2009


(2) is not supported in the spec. Decorators can't decorate concrete types.

On Thu, Dec 3, 2009 at 4:42 PM, Mark Struberg <struberg at yahoo.de> wrote:
> Hi folks!
>
> I'm a bit unsure about the interpretation of the section 8 Decorators in the spec.
>
> There is a sentence which really confuses me:
> "The set of decorated types of a decorator includes all bean types of the managed bean which are Java interfaces..."
>
> I always thought about 2 use cases:
>
> 1.)
> @Decorator
> public class MyDec1 implements AnInterface {
>  @Inject @Delegate AnInterface1 theRealThing;
>  ...
> }
>
> which will decorate all beans which implement the AnInterface.
>
> 2.)
> @Decorator
> public class MyDec2 extends AnotherBeanClass {
>  @Inject @Delegate AnotherBeanClass theRealThing;
>  ...
> }
>
> which will decorate all beans which are of Type (+subclasses) of AnotherBeanClass.
>
> This thoughts are basically backed by a few other paragraphs in the spec and also by the TCK (org.jboss.jsr299.tck.tests.lookup.injectionpoint.CatDecorator).
>
> But for 2) the AnotherBeanClass doesn't need to implement any Interface at all (at least from the practical point of view).
>
>
> txs and LieGrue,
> strub
>
> __________________________________________________
> Do You Yahoo!?
> Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz gegen Massenmails.
> http://mail.yahoo.com
>
> _______________________________________________
> weld-dev mailing list
> weld-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/weld-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