/** * If the context is passivating then we need to wrap it into a version which * uses the {@link SerializableBeanVault } */ public Context wrapCustomContext(Context context) { if (isPassivatingScope(context.getScope())) { if (context instanceof AlterableContext) { return new CustomAlterablePassivatingContextImpl(webBeansContext.getSerializableBeanVault(), (AlterableContext) context); } else { return new CustomPassivatingContextImpl(webBeansContext.getSerializableBeanVault(), context); } } return context; }