javax.enterprise.inject.spi.Bean.getInjectionPoints()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(10.4k)|赞(0)|评价(0)|浏览(188)

本文整理了Java中javax.enterprise.inject.spi.Bean.getInjectionPoints()方法的一些代码示例,展示了Bean.getInjectionPoints()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bean.getInjectionPoints()方法的具体详情如下:
包路径:javax.enterprise.inject.spi.Bean
类名称:Bean
方法名:getInjectionPoints

Bean.getInjectionPoints介绍

[英]Obtains the javax.enterprise.inject.spi.InjectionPoint objects representing injection points of the bean, that will be validated by the container at initialization time.
[中]获取javax。企业注射spi。表示bean的注入点的InjectionPoint对象,该注入点将在初始化时由容器验证。

代码示例

代码示例来源:origin: org.apache.openwebbeans/openwebbeans-impl

@Override
public Set<InjectionPoint> getInjectionPoints()
{
  return bean.getInjectionPoints();
}

代码示例来源:origin: org.apache.openwebbeans/openwebbeans-impl

@Override
  public Set<InjectionPoint> getInjectionPoints()
  {
    return bean.getInjectionPoints();
  }
};

代码示例来源:origin: weld/core

/**
 * 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<?>>());
}

代码示例来源:origin: org.jboss.weld.se/weld-se-shaded

/**
 * 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<?>>());
}

代码示例来源:origin: weld/core

/**
 * 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<?>>());
}

代码示例来源:origin: org.jboss.weld.se/weld-se

/**
 * 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<?>>());
}

代码示例来源:origin: weld/core

/**
 * 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<?>>());
}

代码示例来源:origin: org.glassfish/javax.faces

/** 
 * 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;
}

代码示例来源:origin: org.jboss.cdi.tck/cdi-tck-impl

@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());
}

代码示例来源:origin: org.jboss.cdi.tck/cdi-tck-impl

@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));
}

代码示例来源:origin: omnifaces/omnifaces

/**
 * @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;
}

代码示例来源:origin: org.omnifaces/omnifaces

/**
 * @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;
}

代码示例来源:origin: org.apache.openwebbeans/openwebbeans-impl

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());
}

代码示例来源:origin: com.tomitribe.tribestream/tribestream-container

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()));
    }
  }
}

代码示例来源:origin: apache/deltaspike

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());
  }
}

代码示例来源:origin: weld/core

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);
  }
}

代码示例来源:origin: org.jboss.weld.se/weld-se

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);
  }
}

代码示例来源:origin: weld/core

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);
  }
}

代码示例来源:origin: weld/core

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);
  }
}

代码示例来源:origin: org.jboss.weld.se/weld-se-shaded

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);
  }
}

相关文章