[webbeans-dev] Re: Patterns of reuse

Gavin King gavin.king at gmail.com
Fri Nov 28 19:47:22 EST 2008


I need to see a more realistic usecase. Why does subtypeimpl even need  
to decorate the method that was already decorated by basetypeimpl?

Sent from my iPhone

On Nov 28, 2008, at 11:50 AM, Ted Stockwell <emorning at yahoo.com> wrote:

>
> How embarassing, the first time I send a message to this list I  
> accidently send it before I was done writing, sorry....
> ---------------
>
> I would maybe call the third case a 'subBean".
>
> I have also run into a problem regarding decorators of 'subBeans'.
> The problem is that if I create a decorator of a subBean then I  
> currently have no way of calling methods in the 'superBean'.
>
> I imagine that the spec may have to be extended with a DI annotation  
> like @SuperBean (@SuperBean like the @Decorates annotation only it  
> is set to a reference that delegates calls to the superBean instead  
> of the the next method in the current stack of interceptors for the  
> subBean).
> @SuperBean would be used somelike this this...
>
> public interface BaseType {
>     public String getDescription();
> }
> public class SubType extends BaseType {
> }
> @Decorator public BaseTypeImpl implements BaseType {
>      public String getDescription() { return "BaseType"; }
> }
> @Decorator public SubTypeImpl implements SubType {
>      @SuperBean superBean;
>      public String getDescription() { return superBean.getDescription 
> ()+":SubType";
> }
>
> So, the following expressions should be true...
>
> Bean baseTypeBean= ....;
> Bean superTypeBean= ....
>
> baseTypeBean.create().getDescription().equals("BaseType");
> superTypeBean.create().getDescription().equals("BaseType:SubType");
>
>
>
>
>
> --- On Thu, 11/27/08, Gavin King <gavin at hibernate.org> wrote:
> From: Gavin King <gavin at hibernate.org>
> Subject: [webbeans-dev] Re: Patterns of reuse
> To: "Java Community Process JSR #299 Expert List" <JSR-299- 
> EG at jcp.org>, "Matt Drees" <matt.drees at gmail.com>, "Scott Ferguson" <ferg at caucho.com 
> >, "webbeans-dev at lists.jboss.org" <webbeans-dev at lists.jboss.org>
> Date: Thursday, November 27, 2008, 4:34 PM
>
> On Thu, Nov 27, 2008 at 4:09 PM, Gavin King <gavin at hibernate.org>  
> wrote:
>
> > In case 1, it doesn't really make sense to inherit any web beans
> > metadata to the subtype. In cases 2 and 3, it makes sense to inherit
> > everything that is not explicitly overridden.
>
> Minor clarification: in case 3, it does not make sense to inherit
> binding types - rather, the user should be forced to *explicitly*
> redeclare the binding types.
>
> In case 2, binding types are inherited.
>
>
>
> -- 
> Gavin King
> gavin.king at gmail.com
> http://in.relation.to/Bloggers/Gavin
> http://hibernate.org
> http://seamframework.org
> _______________________________________________
> webbeans-dev mailing list
> webbeans-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/webbeans-dev
>
> _______________________________________________
> webbeans-dev mailing list
> webbeans-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/webbeans-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/weld-dev/attachments/20081128/34a8ea73/attachment.html 


More information about the weld-dev mailing list