[weld-dev] Decorator question
Mark Struberg
struberg at yahoo.de
Thu Dec 3 16:42:37 EST 2009
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
More information about the weld-dev
mailing list