Skip to content

Commit

Permalink
Add a readResolve method
Browse files Browse the repository at this point in the history
git-svn-id: http://anonsvn.jboss.org/repos/weld/ri/trunk@3857 1c488680-804c-0410-94cd-c6b725194a0e
  • Loading branch information
pmuir committed Oct 5, 2009
1 parent d60103a commit a68f878
Showing 1 changed file with 8 additions and 3 deletions.
Expand Up @@ -46,14 +46,14 @@ public class InstanceImpl<T> extends AbstractFacade<T, Instance<T>> implements I
private static final long serialVersionUID = -376721889693284887L;
private static final Annotation[] EMPTY_BINDINGS = new Annotation[0];

private final Set<Bean<?>> beans;
private transient final Set<Bean<?>> beans;

public static <I> Instance<I> of(Type type, BeanManagerImpl manager, Set<Annotation> annotations)
{
return new InstanceImpl<I>(type, manager, annotations);
}

private InstanceImpl(Type type, BeanManagerImpl manager, Set<Annotation> bindings)
private InstanceImpl(Type type, BeanManagerImpl manager, Set<? extends Annotation> bindings)
{
super(type, manager, bindings);
this.beans = getManager().getBeans(getType(), bindings.toArray(EMPTY_BINDINGS));
Expand Down Expand Up @@ -136,6 +136,11 @@ private <U extends T> Instance<U> selectInstance(Type subtype, Annotation[] bind
subtype,
this.getManager(),
new HashSet<Annotation>(Arrays.asList(mergeInBindings(bindings))));
}
}

protected Object readResolve()
{
return new InstanceImpl<T>(getType(), getManager(), getBindings());
}

}

0 comments on commit a68f878

Please sign in to comment.