I've got feedback from a number of people that stereotype inheritance
should be supported, and I agree with this feedback.
I think we should just do it in the simplest possible way and say
simply that stereotype declarations are transitive, and
meta-stereotypes are inherited by the web bean.
Therefore:
1. the sets of interceptor binding types are unioned
2. any conflicts between default scope/deployment type defined by a
stereotype and its meta-stereotypes must be resolved by explicit
declaration on the web bean
3. all restrictions apply cumulatively
And I've written this into section 2.7.1.5 of the attached spec draft.
Questions:
========
Does anybody think that the default scope/deployment type declared
directly by a stereotype should *override* the default
scopes/deployment types declared by its meta-stereotypes? This rule
makes a lot of sense, but it kinda makes things a little more complex.
For example:
@RequestScoped
@Stereotype
public @interface Foo {}
@SessionScoped
@Foo
@Stereotype
public @interface Bar {}
Should we force a web bean that declares @Bar to explicitly specify a
scope, or is it better to let @SessionScoped on Bar override
@RequestScoped on Foo.
Another thing I've just noticed, that applies to interceptor bindings
inherited by both stereotypes and other interceptor binding types, is
that you could potentially have a web bean with multiple "instances"
of the same interceptor binding type - the same type, but different
member values. I think we should say that this is a
DefinitionException.
For example:
@Transactional(requiresNew=false)
@Stereotype
public @interface Foo {}
@Transactional(requiresNew=true)
@Stereotype
public @interface Foo {}
@Foo @Bar
public class X {}
Then X has both @Transactional(requiresNew=false) and
@Transactional(requiresNew=true).
--
Gavin King
gavin.king(a)gmail.com
http://in.relation.to/Bloggers/Gavin
http://hibernate.org
http://seamframework.org