/** * {@inheritDoc} */ @Override public T create(CreationalContext<T> creationalContext) { T instance = null; instance = super.create(creationalContext); checkNullInstance(instance, producerField.getName()); checkScopeType(producerField.getName(), instance); return instance; }
/** * Check passivation check. */ protected void checkScopeType(String producerName, Object instance) { String errorMessage = "WebBeans producer : %s" + " instance in the component implementation class : %s" + " with passivating scope @%s" + " must be Serializable"; getWebBeansContext().getWebBeansUtil().checkSerializableScopeType(getScope(), Serializable.class.isInstance(instance), errorMessage, producerName, getBeanClass().getName(), getScope().getName()); }
@Override public String getId() { if (passivatingId == null) { String id = super.getId(); passivatingId = id + "#" + creatorMethod.toGenericString(); } return passivatingId; }
/** * Check null control. * * @param instance bean instance */ protected void checkNullInstance(Object instance, String producerName) { String errorMessage = "WebBeans producer : %s" + " return type in the component implementation class : %s" + " scope type must be @Dependent to create null instance"; WebBeansUtil.checkNullInstance(instance, getScope(), errorMessage, producerName, getBeanClass().getName()); }
Set<Class<? extends Annotation>> stereotypes = producer.getStereotypes(); producer.setEnabled(isAlternative(parent.getAnnotatedType(), parent.getStereotypes()) && webBeansContext.getAlternativesManager().isAlternative(parent) || isAlternative(parent.getAnnotatedType(), stereotypes) && webBeansContext.getAlternativesManager().isAlternative(producer)); producer.setEnabled(parent.isEnabled());
if (AbstractProducerBean.class.isInstance(bean) && AbstractProducerBean.class.cast(bean).getOwnerComponent().isAlternative())
private void validateDisposeParameters() { WebBeansUtil webBeansUtil = webBeansContext.getWebBeansUtil(); for (Bean<?> bean : webBeansContext.getBeanManagerImpl().getBeans()) { if (ProducerMethodBean.class.isInstance(bean)) { Producer<?> producer = AbstractProducerBean.class.cast(bean).getProducer(); if (BaseProducerProducer.class.isInstance(producer)) { BaseProducerProducer producerProducer = BaseProducerProducer.class.cast(producer); Set<InjectionPoint> disposalIPs = producerProducer.getDisposalIPs(); if (disposalIPs != null && !producerProducer.isAnyDisposal()) // any can be ambiguous but that's not an issue { webBeansUtil.validate(disposalIPs, bean); } } } } }
((AbstractProducerBean) bean).getOwnerComponent().isAlternative()))
@Override public T create(CreationalContext<T> creationalContext) { T instance = super.create(creationalContext); // Check null instance checkNullInstance(instance, creatorMethod.getName()); // Check scope type checkScopeType(creatorMethod.getName(), instance); return instance; }
@Override public String getId() { if (passivatingId == null) { String id = super.getId(); passivatingId = id + "#" + producerField.toGenericString(); } return passivatingId; }