@Override public Set<InjectionPoint> getInjectionPoints() { return bean.getInjectionPoints(); }
@Override public Set<InjectionPoint> getInjectionPoints() { return bean.getInjectionPoints(); } };
/** * Checks to make sure that pseudo scoped beans (i.e. @Dependent scoped beans) have no circular dependencies. */ private static void validatePseudoScopedBean(Bean<?> bean, BeanManagerImpl beanManager) { if (bean.getInjectionPoints().isEmpty()) { // Skip validation if there are no injection points (e.g. for classes which are not intended to be used as beans) return; } reallyValidatePseudoScopedBean(bean, beanManager, new LinkedHashSet<Object>(), new HashSet<Bean<?>>()); }
/** * Checks to make sure that pseudo scoped beans (i.e. @Dependent scoped beans) have no circular dependencies. */ private static void validatePseudoScopedBean(Bean<?> bean, BeanManagerImpl beanManager) { if (bean.getInjectionPoints().isEmpty()) { // Skip validation if there are no injection points (e.g. for classes which are not intended to be used as beans) return; } reallyValidatePseudoScopedBean(bean, beanManager, new LinkedHashSet<Object>(), new HashSet<Bean<?>>()); }
/** * Checks to make sure that pseudo scoped beans (i.e. @Dependent scoped beans) have no circular dependencies. */ private static void validatePseudoScopedBean(Bean<?> bean, BeanManagerImpl beanManager) { if (bean.getInjectionPoints().isEmpty()) { // Skip validation if there are no injection points (e.g. for classes which are not intended to be used as beans) return; } reallyValidatePseudoScopedBean(bean, beanManager, new LinkedHashSet<Object>(), new HashSet<Bean<?>>()); }
/** * Checks to make sure that pseudo scoped beans (i.e. @Dependent scoped beans) have no circular dependencies. */ private static void validatePseudoScopedBean(Bean<?> bean, BeanManagerImpl beanManager) { if (bean.getInjectionPoints().isEmpty()) { // Skip validation if there are no injection points (e.g. for classes which are not intended to be used as beans) return; } reallyValidatePseudoScopedBean(bean, beanManager, new LinkedHashSet<Object>(), new HashSet<Bean<?>>()); }
/** * Checks to make sure that pseudo scoped beans (i.e. @Dependent scoped beans) have no circular dependencies. */ private static void validatePseudoScopedBean(Bean<?> bean, BeanManagerImpl beanManager) { if (bean.getInjectionPoints().isEmpty()) { // Skip validation if there are no injection points (e.g. for classes which are not intended to be used as beans) return; } reallyValidatePseudoScopedBean(bean, beanManager, new LinkedHashSet<Object>(), new HashSet<Bean<?>>()); }
/** * Returns the current injection point. */ public static InjectionPoint getCurrentInjectionPoint(BeanManager beanManager, CreationalContext<?> creationalContext) { Bean<? extends Object> bean = beanManager.resolve(beanManager.getBeans(InjectionPoint.class)); InjectionPoint injectionPoint = (InjectionPoint) beanManager.getReference(bean, InjectionPoint.class, creationalContext); if (injectionPoint == null) { // It's broken in some Weld versions. Below is a work around. bean = beanManager.resolve(beanManager.getBeans(InjectionPointGenerator.class)); injectionPoint = (InjectionPoint) beanManager.getInjectableReference(bean.getInjectionPoints().iterator().next(), creationalContext); } return injectionPoint; }
@Test @SpecAssertion(section = NEW_EE, id = "n") public void testNewBeanHasSameInjectedFields() { Bean<InitializerSimpleBeanLocal> simpleBean = getBeans(InitializerSimpleBeanLocal.class).iterator().next(); Bean<InitializerSimpleBeanLocal> newSimpleBean = getBeans(InitializerSimpleBeanLocal.class, New.Literal.of(InitializerSimpleBean.class)).iterator().next(); assert !newSimpleBean.getInjectionPoints().isEmpty(); assert simpleBean.getInjectionPoints().equals(newSimpleBean.getInjectionPoints()); }
@Test @SpecAssertions({ @SpecAssertion(section = BUILTIN_QUALIFIERS, id = "b"), @SpecAssertion(section = BEAN, id = "c") }) public void testDefaultQualifierForInjectionPoint() { Bean<Order> order = getBeans(Order.class).iterator().next(); assertEquals(order.getInjectionPoints().size(), 1); InjectionPoint injectionPoint = order.getInjectionPoints().iterator().next(); assertTrue(injectionPoint.getQualifiers().contains(Default.Literal.INSTANCE)); }
/** * @see Beans#getAnnotation(Annotated, Class) */ public static InjectionPoint getCurrentInjectionPoint(BeanManager beanManager, CreationalContext<?> creationalContext) { Bean<InjectionPointGenerator> bean = resolve(beanManager, InjectionPointGenerator.class); return (bean != null) ? (InjectionPoint) beanManager.getInjectableReference(bean.getInjectionPoints().iterator().next(), creationalContext) : null; }
/** * @see Beans#getAnnotation(Annotated, Class) */ public static InjectionPoint getCurrentInjectionPoint(BeanManager beanManager, CreationalContext<?> creationalContext) { Bean<InjectionPointGenerator> bean = resolve(beanManager, InjectionPointGenerator.class); return (bean != null) ? (InjectionPoint) beanManager.getInjectableReference(bean.getInjectionPoints().iterator().next(), creationalContext) : null; }
private <T> void validatePassivationCapableDependency(Bean<T> bean, Bean<?> dependentBean) { if (!isPassivationCapable(dependentBean)) { String type = dependentBean instanceof Interceptor? "Interceptor ": "Decorator "; throw new WebBeansDeploymentException( "Passivation capable beans must satisfy passivation capable dependencies. " + "Bean : " + bean.toString() + " does not satisfy. " + type + dependentBean.toString() + " is not passivation capable"); } validatePassivationCapableDependencies(bean, dependentBean.getInjectionPoints()); }
void captureTypes(@Observes final ProcessBean<?> bean) { for (final InjectionPoint ip : bean.getBean().getInjectionPoints()) { final Component component = ip.getAnnotated().getAnnotation(Component.class); if (component != null) { beans.add(new ComponentBean(component, ip.getType())); } } }
public void collectDynamicTypes(@Observes ProcessBean<?> processBean) { for (final InjectionPoint ip : processBean.getBean().getInjectionPoints()) { final ConfigProperty annotation = ip.getAnnotated().getAnnotation(ConfigProperty.class); if (annotation == null || annotation.converter() == ConfigResolver.Converter.class) { continue; } dynamicConfigTypes.add(ip.getType()); } }
protected void validateGeneralBean(Bean<?> bean, BeanManagerImpl beanManager) { for (InjectionPoint ij : bean.getInjectionPoints()) { validateInjectionPoint(ij, beanManager); } // Validate all pseudo-scoped beans, except for built-in beans and session beans which are proxied by the EJB container if (!beanManager.isNormalScope(bean.getScope()) && !(bean instanceof AbstractBuiltInBean) && !(bean instanceof SessionBean)) { validatePseudoScopedBean(bean, beanManager); } if (beanManager.isPassivatingScope(bean.getScope()) && !Beans.isPassivationCapableBean(bean)) { throw ValidatorLogger.LOG.beanWithPassivatingScopeNotPassivationCapable(bean); } }
protected void validateGeneralBean(Bean<?> bean, BeanManagerImpl beanManager) { for (InjectionPoint ij : bean.getInjectionPoints()) { validateInjectionPoint(ij, beanManager); } // Validate all pseudo-scoped beans, except for built-in beans and session beans which are proxied by the EJB container if (!beanManager.isNormalScope(bean.getScope()) && !(bean instanceof AbstractBuiltInBean) && !(bean instanceof SessionBean)) { validatePseudoScopedBean(bean, beanManager); } if (beanManager.isPassivatingScope(bean.getScope()) && !Beans.isPassivationCapableBean(bean)) { throw ValidatorLogger.LOG.beanWithPassivatingScopeNotPassivationCapable(bean); } }
protected void validateGeneralBean(Bean<?> bean, BeanManagerImpl beanManager) { for (InjectionPoint ij : bean.getInjectionPoints()) { validateInjectionPoint(ij, beanManager); } // Validate all pseudo-scoped beans, except for built-in beans and session beans which are proxied by the EJB container if (!beanManager.isNormalScope(bean.getScope()) && !(bean instanceof AbstractBuiltInBean) && !(bean instanceof SessionBean)) { validatePseudoScopedBean(bean, beanManager); } if (beanManager.isPassivatingScope(bean.getScope()) && !Beans.isPassivationCapableBean(bean)) { throw ValidatorLogger.LOG.beanWithPassivatingScopeNotPassivationCapable(bean); } }
protected void validateGeneralBean(Bean<?> bean, BeanManagerImpl beanManager) { for (InjectionPoint ij : bean.getInjectionPoints()) { validateInjectionPoint(ij, beanManager); } // Validate all pseudo-scoped beans, except for built-in beans and session beans which are proxied by the EJB container if (!beanManager.isNormalScope(bean.getScope()) && !(bean instanceof AbstractBuiltInBean) && !(bean instanceof SessionBean)) { validatePseudoScopedBean(bean, beanManager); } if (beanManager.isPassivatingScope(bean.getScope()) && !Beans.isPassivationCapableBean(bean)) { throw ValidatorLogger.LOG.beanWithPassivatingScopeNotPassivationCapable(bean); } }
protected void validateGeneralBean(Bean<?> bean, BeanManagerImpl beanManager) { for (InjectionPoint ij : bean.getInjectionPoints()) { validateInjectionPoint(ij, beanManager); } // Validate all pseudo-scoped beans, except for built-in beans and session beans which are proxied by the EJB container if (!beanManager.isNormalScope(bean.getScope()) && !(bean instanceof AbstractBuiltInBean) && !(bean instanceof SessionBean)) { validatePseudoScopedBean(bean, beanManager); } if (beanManager.isPassivatingScope(bean.getScope()) && !Beans.isPassivationCapableBean(bean)) { throw ValidatorLogger.LOG.beanWithPassivatingScopeNotPassivationCapable(bean); } }