[webbeans-dev] Re: Bean.getInjectionPoints()

Scott Ferguson ferg at caucho.com
Fri Jan 2 10:23:53 EST 2009


On Jan 2, 2009, at 1:40 AM, Gavin King wrote:

> No, this stuff does actually require a well-defined contract because
> Bean is an extension point that is implemented by third-parties.

SPI requirements are substantially different from API requirements.   
An SPI is basically a driver, and it's appropriate to make validation  
demands a driver provider as part of the spec.  Writing a Bean will be  
rare.

Cluttering up a spec to force validation from an SPI provider is not a  
good idea.  In general, validation interfaces don't work, and just  
make implementations and the spec more difficult and complex, and  
don't really save anyone time or improve any quality.  Validation  
requirements in the written spec are great, of course.

-- Scott

>
>
> On Fri, Jan 2, 2009 at 6:05 PM, Gurkan Erdogdu <gurkanerdogdu at yahoo.com 
> > wrote:
>> Just my comment:
>>
>> For adding the new API for this complicates the specification.
>> I think, specification provides the necessary API related with Bean
>> creation. As I said, these concerns are left to the implementations.
>>
>> Gurkan
>>
>> ________________________________
>> From: Gavin King <gavin at hibernate.org>
>> To: Scott Ferguson <ferg at caucho.com>
>> Cc: Michael Keith <michael.keith at oracle.com>; WebBeans
>> <webbeans-dev at lists.jboss.org>; Java Community Process JSR #299  
>> Expert List
>> <JSR-299-EG at jcp.org>
>> Sent: Friday, January 2, 2009 7:19:20 AM
>> Subject: Re: [webbeans-dev] Re: Bean.getInjectionPoints()
>>
>> On Fri, Jan 2, 2009 at 3:42 PM, Gavin King <gavin at hibernate.org>  
>> wrote:
>>
>>> Actually I think there is a better way to solve the problem, but I
>>> need to talk it over with Pete.
>>
>> The alternate solution is something like:
>>
>>  interface CreationalContext {
>>      void add(Bean<X> bean, X instance); //registers an "incomplete"
>> instance
>>  }
>>
>>  interface Contextual<T> {
>>      public abstract T create(CreationalContext ctx);
>>      ...
>>  }
>>
>>  interface Context {
>>      public <T> T get(Contextual<T> bean); //get any existing  
>> instance
>>      public <T> T get(Contextual<T> bean, CreationalContext ctx);
>> //get or create an instance
>>
>>      public Class<? extends Annotation> getScopeType();
>>      boolean isActive();
>>  }
>>
>>  interface Manager {
>>      Object getInstanceToInject(CreationalContext ctx,
>> InjectionPoint ij, Type type, Annotation... bindings);
>>      ...
>>  }
>>
>> And getInstanceToInject() would be smart enough to return any object
>> that had already been registered with the CreationalContext.
>>
>> Note that this solution addresses the problem of circular references,
>> and also fixes a hole in how the Manager knows about the
>> InjectionPoint.
>>
>> --
>> 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
>>
>>
>
>
>
> -- 
> 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