[webbeans-dev] CreationalContext

Gavin King gavin at hibernate.org
Thu Jan 8 13:03:03 EST 2009


Folks, I would like to go ahead and write up this change, unless anyone objects.

It's a hole that needs fixing.

On Fri, Jan 2, 2009 at 4:19 PM, Gavin King <gavin at hibernate.org> wrote:

> The alternate solution is something like:
>
>   interface CreationalContext {
>       <X> 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



More information about the weld-dev mailing list