s.writeObject(scopeType);
// we need to repack the Contextual<T> from the componentInstanceMap into Serializable ones
if (componentInstanceMap != null)
{
SerializableBeanVault sbv = org.apache.webbeans.config.WebBeansContext.getInstance().getSerializableBeanVault();
Map<Contextual<?>, BeanInstanceBag<?>> serializableInstanceMap =
new HashMap<Contextual<?>, BeanInstanceBag<?>>();
for (Map.Entry<Contextual<?>, BeanInstanceBag<?>> componentInstanceMapEntry : componentInstanceMap.entrySet())
{
serializableInstanceMap.put(sbv.getSerializableBean(componentInstanceMapEntry.getKey()),
componentInstanceMapEntry.getValue());
}
s.writeObject(serializableInstanceMap);
}