[weld-dev] Decorator question

Gavin King gavin.king at gmail.com
Sat Dec 5 09:35:40 EST 2009


On Sat, Dec 5, 2009 at 6:12 AM, Mark Struberg <struberg at yahoo.de> wrote:

> BUT: yesterday I had a long discussion with Pete and it looks like the only real source of the
> 'decorated type' is in fact the type of the member which is annotated with @Delegate!
> Because the type of the @Delegated bean exactly defines the beans the decorator will be
> applied to.

No, this is not correct. The delegate has to implement all decorated
types. The decorator does not need to implement all bean types of the
delegate.

Thus, the delegate injection point can require bean types that are not
decorated.

> But then another question comes up: why the hell does the decorator itself need to
> implement an interface at all? The proxy will simply lookup if the decorator has a function with exactly the same signature of the decorated type, and if not will delegate the functions to the @Delegated bean.

And that would be totally broken and untypesafe and unrefactorable and awful.


-- 
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