[webbeans-dev] Fwd: Patterns of reuse

Gavin King gavin at hibernate.org
Tue Dec 2 18:28:16 EST 2008


Folks, please read this first draft of chapter 4.

---------- Forwarded message ----------
From: Gavin King <gavin at hibernate.org>
Date: Tue, Dec 2, 2008 at 5:26 PM
Subject: Re: Patterns of reuse
To: Java Community Process JSR #299 Expert List <JSR-299-EG at jcp.org>


OK, here's a draft of the new Chapter 4 that implements this idea.

Please read this over and let me know what you think!

On Tue, Dec 2, 2008 at 2:26 PM, Gavin King <gavin at hibernate.org> wrote:
> So, after talking this over with Jason, we're inclined to think that
> we should rely on the use of the @Inherited annotation in
> java.lang.annotation to control inheritance of type-level metadata:
>
> * scope
> * deployment type
> * binding types
> * name
> * stereotypes
> * type-level interceptor bindings
>
> For annotations defined by the spec, we would say that:
>
> * all built-in scope types are declared @Inherited
> * no built-in binding type is declared @Inherited
> * @Name is not declared @Inherited
> * no built-in stereotype is declared @Inherited
>
> There are four scenarios of metadata inheritance in the spec today:
>
> * implementation class inheritance
> * XML configuration
> * stereotype transitivity
> * interceptor binding type transitivity
>
> I think @Inherited is definitely a good way of controlling metadata
> inheritance in the cases of implementation class inheritance and XML
> configuration. For example, if we have the following types:
>
>   @MyStereotype
>   class Foo { ... }
>
>   class Bar extends Foo { .... }
>
> then it seems completely natural to me that we would decide whether
> @MyStereotype is inherited by Bar on the basis of whether it is
> declared @Inherited. Likewise, it seems natural in the case of XML
> configuration:
>
>   <myapp:Foo>
>      ...
>   </myapp:Foo>
>
> The big question in my mind is whether it is also appropriate to use
> this mechanism to control transitivity of metadata declared by
> stereotypes, for example, suppose that @MyStereotype declares
> @MyOtherStereotype:
>
>   @MyOtherStereotype
>   @Stereotype
>   ...
>   public @interface MyStereotype { ... }
>
> And @MyOtherStereotype declares a deployment type:
>
>   @Staging
>   @Stereotype
>   ...
>   public @interface MyOtherStereotype { ... }
>
> Should we look at the @Inherited annotation to decide if @Staging is
> inherited by @MyStereotype? I'm thinking that the answer is "no", but
> I'm not sure.
>
> Of course, we still need to define "special" rules for the
> member-level metadata:
>
> * method-level interceptor bindings
> * initializer methods + injected fields
> * producer/disposal
> * observer methods
>
> Does all that make sense?
>
> --
> Gavin King
> gavin.king at gmail.com
> http://in.relation.to/Bloggers/Gavin
> http://hibernate.org
> http://seamframework.org
>



--
Gavin King
gavin.king at gmail.com
http://in.relation.to/Bloggers/Gavin
http://hibernate.org
http://seamframework.org



-- 
Gavin King
gavin.king at gmail.com
http://in.relation.to/Bloggers/Gavin
http://hibernate.org
http://seamframework.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Web Beans 20081202.pdf
Type: application/pdf
Size: 530784 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/weld-dev/attachments/20081202/62a54cf5/attachment.pdf 


More information about the weld-dev mailing list