Search in sources :

Example 1 with AbstractDecorableBuiltInBean

use of org.jboss.weld.bean.builtin.AbstractDecorableBuiltInBean in project core by weld.

the class Validator method validateDecorators.

private void validateDecorators(BeanManagerImpl beanManager, DecorableBean<?> bean) {
    if (!(beanManager.isPassivatingScope(bean.getScope()) || bean instanceof AbstractDecorableBuiltInBean<?>)) {
        return;
    }
    List<Decorator<?>> decorators = bean.getDecorators();
    if (decorators.isEmpty()) {
        return;
    }
    for (Decorator<?> decorator : decorators) {
        if (!Decorators.isPassivationCapable(decorator)) {
            if (bean instanceof AbstractDecorableBuiltInBean<?>) {
                throw ValidatorLogger.LOG.builtinBeanWithNonserializableDecorator(decorator, bean);
            } else {
                throw ValidatorLogger.LOG.passivatingBeanWithNonserializableDecorator(bean, decorator);
            }
        }
        if (decorator instanceof DecoratorImpl) {
            beanManager = ((DecoratorImpl<?>) decorator).getBeanManager();
        }
        for (InjectionPoint ij : decorator.getInjectionPoints()) {
            if (!ij.isDelegate()) {
                Bean<?> resolvedBean = beanManager.resolve(beanManager.getBeans(ij));
                validateInterceptorDecoratorInjectionPointPassivationCapable(ij, resolvedBean, beanManager, bean);
            }
        }
    }
}
Also used : WeldDecorator(org.jboss.weld.bean.WeldDecorator) Decorator(javax.enterprise.inject.spi.Decorator) DecoratorImpl(org.jboss.weld.bean.DecoratorImpl) InjectionPoint(javax.enterprise.inject.spi.InjectionPoint) AbstractDecorableBuiltInBean(org.jboss.weld.bean.builtin.AbstractDecorableBuiltInBean)

Aggregations

Decorator (javax.enterprise.inject.spi.Decorator)1 InjectionPoint (javax.enterprise.inject.spi.InjectionPoint)1 DecoratorImpl (org.jboss.weld.bean.DecoratorImpl)1 WeldDecorator (org.jboss.weld.bean.WeldDecorator)1 AbstractDecorableBuiltInBean (org.jboss.weld.bean.builtin.AbstractDecorableBuiltInBean)1