[webbeans-dev] NewXxxxxBean

Nicklas Karlsson nickarls at gmail.com
Mon Jan 12 15:50:48 EST 2009


On Mon, Jan 12, 2009 at 6:26 PM, Gavin King <gavin at hibernate.org> wrote:
> wouldn't it be better to implement a single NewBean, that wraps and
> delegates to the SimpleBean or EnterpriseBean?

Yes. But if we have a delegating bean that overrides stuff according
to the specification, e.g.

   @Override
   public Class<? extends Annotation> getScopeType()
   {
      return Dependent.class;
   }

and then e.g Create looks like

public T create() {
  return getDelegate().create();
}

we end up in the delegate and the it happily uses its own
getScopeType(), unaware on that it has been wrapped.

And if we override create() we have the problem of the different
create implementations for SimpleBean and EnterpriseBean

Or?

---
Nik



More information about the weld-dev mailing list