org.jboss.weld.environment.se.Weld.addBeanClass()方法的使用及代码示例

x33g5p2x  于2022-02-02 转载在 其他  
字(7.0k)|赞(0)|评价(0)|浏览(181)

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

Weld.addBeanClass介绍

[英]Add a bean class to the set of bean classes for the synthetic bean archive.
[中]将bean类添加到合成bean归档的bean类集中。

代码示例

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

@Override
public Weld addBeanClasses(Class<?>... classes) {
  for (Class<?> aClass : classes) {
    addBeanClass(aClass);
  }
  return this;
}

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

@Override
public Weld addBeanClasses(Class<?>... classes) {
  for (Class<?> aClass : classes) {
    addBeanClass(aClass);
  }
  return this;
}

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

@Override
public Weld addBeanClasses(Class<?>... classes) {
  for (Class<?> aClass : classes) {
    addBeanClass(aClass);
  }
  return this;
}

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

/**
 * Define the set of bean classes for the synthetic bean archive.
 *
 * @param classes
 * @return self
 */
public Weld beanClasses(Class<?>... classes) {
  beanClasses.clear();
  for (Class<?> beanClass : classes) {
    addBeanClass(beanClass);
  }
  return this;
}

代码示例来源:origin: weld/weld-junit

private static List<Class<?>> getExecutableParameterTypes(Executable executable, Weld weld, boolean explicitInjection) {
  List<Class<?>> types = new ArrayList<>();
  if (explicitInjection) {
    Annotation[][] paramAnns = executable.getParameterAnnotations();
    Class<?>[] paramTypes = executable.getParameterTypes();
    for (int c = 0; c < paramAnns.length; ++c) {
      if (stream(paramAnns[c]).anyMatch(ann -> isAnnotated(ann.annotationType(), Qualifier.class) || isAnnotated(ann.annotationType(), NormalScope.class))) {
        weld.addBeanClass(paramTypes[c]);
        types.add(paramTypes[c]);
      }
    }
  } else {
    for (Class<?> paramType : executable.getParameterTypes()) {
      weld.addBeanClass(paramType);
      types.add(paramType);
    }
  }
  return types;
}

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

private static List<Class<?>> getExecutableParameterTypes(Executable executable, Weld weld, boolean explicitInjection) {
  List<Class<?>> types = new ArrayList<>();
  if (explicitInjection) {
    Annotation[][] paramAnns = executable.getParameterAnnotations();
    Class<?>[] paramTypes = executable.getParameterTypes();
    for (int c = 0; c < paramAnns.length; ++c) {
      if (stream(paramAnns[c]).anyMatch(ann -> isAnnotated(ann.annotationType(), Qualifier.class) || isAnnotated(ann.annotationType(), NormalScope.class))) {
        weld.addBeanClass(paramTypes[c]);
        types.add(paramTypes[c]);
      }
    }
  } else {
    for (Class<?> paramType : executable.getParameterTypes()) {
      weld.addBeanClass(paramType);
      types.add(paramType);
    }
  }
  return types;
}

代码示例来源:origin: com.itemis.maven.plugins/cdi-plugin-utils

try {
 Class<?> cls = classLoader.loadClass(className);
 weld.addBeanClass(cls);
} catch (ClassNotFoundException e) {
 log.error("Could not load the following class which might cause later issues: " + className);

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

/**
 * Create a builder instance.
 *
 * @param weld
 * @return a builder instance
 * @see #of(Class...)
 */
@SuppressWarnings("unchecked")
public static Builder from(Class<?>... beanClasses) {
  Weld weld = createWeld();
  for (Class<?> clazz : beanClasses) {
    if (Extension.class.isAssignableFrom(clazz)) {
      weld.addExtensions((Class<? extends Extension>) clazz);
    } else {
      weld.addBeanClass(clazz);
    }
  }
  return from(weld);
}

代码示例来源:origin: weld/weld-junit

/**
 * Create a builder instance.
 *
 * @param weld
 * @return a builder instance
 * @see #of(Class...)
 */
public static Builder from(Class<?>... beanClasses) {
  Weld weld = createWeld();
  for (Class<?> clazz : beanClasses) {
    if (Extension.class.isAssignableFrom(clazz)) {
      weld.addExtensions((Class<? extends Extension>) clazz);
    } else {
      weld.addBeanClass(clazz);
    }
  }
  return from(weld);
}

代码示例来源:origin: weld/weld-junit

/**
 * Create a builder instance.
 *
 * @param weld
 * @return a builder instance
 * @see #of(Class...)
 */
@SuppressWarnings("unchecked")
public static Builder from(Class<?>... beanClasses) {
  Weld weld = createWeld();
  for (Class<?> clazz : beanClasses) {
    if (Extension.class.isAssignableFrom(clazz)) {
      weld.addExtensions((Class<? extends Extension>) clazz);
    } else {
      weld.addBeanClass(clazz);
    }
  }
  return from(weld);
}

代码示例来源:origin: weld/weld-junit

@Override
protected void weldInit(Object testInstance, ExtensionContext context, Weld weld, WeldInitiator.Builder weldInitiatorBuilder) {
  Class<?> testClass = testInstance.getClass();
  weld.addAlternativeStereotype(OverrideBean.class);
  ClassScanning.scanForRequiredBeanClass(testClass, weld, getExplicitInjectionInfoFromStore(context));
  weld.addBeanClass(testClass);
  weld.addExtension(new TestInstanceInjectionExtension(testClass, testInstance));
  AnnotationSupport.findRepeatableAnnotations(testClass, ActivateScopes.class)
      .forEach(ann -> weldInitiatorBuilder.activate(ann.value()));
}

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

@Override
protected void weldInit(Object testInstance, ExtensionContext context, Weld weld, WeldInitiator.Builder weldInitiatorBuilder) {
  Class<?> testClass = testInstance.getClass();
  weld.addAlternativeStereotype(OverrideBean.class);
  ClassScanning.scanForRequiredBeanClass(testClass, weld, getExplicitInjectionInfoFromStore(context));
  weld.addBeanClass(testClass);
  weld.addExtension(new TestInstanceInjectionExtension(testClass, testInstance));
  AnnotationSupport.findRepeatableAnnotations(testClass, ActivateScopes.class)
      .forEach(ann -> weldInitiatorBuilder.activate(ann.value()));
}

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

.forEach(interceptor -> {
    weld.addInterceptor(interceptor);
    weld.addBeanClass(interceptor);
  });
  .forEach(decorator -> {
    weld.addDecorator(decorator);
    weld.addBeanClass(decorator);
  });
weld.addBeanClass(foundClass);

代码示例来源:origin: weld/weld-junit

.forEach(interceptor -> {
    weld.addInterceptor(interceptor);
    weld.addBeanClass(interceptor);
  });
  .forEach(decorator -> {
    weld.addDecorator(decorator);
    weld.addBeanClass(decorator);
  });
weld.addBeanClass(foundClass);

代码示例来源:origin: org.apache.camel/camel-test-cdi

CamelCdiDeployment(TestClass test, CamelCdiContext context) {
  this.context = context;
  weld = new Weld()
    // TODO: check parallel execution
    .containerId("camel-context-cdi")
    .property(ConfigurationKey.RELAXED_CONSTRUCTION.get(), true)
    .property(Weld.SHUTDOWN_HOOK_SYSTEM_PROPERTY, false)
    .enableDiscovery()
    .beanClasses(test.getJavaClass().getDeclaredClasses())
    .addBeanClass(test.getJavaClass())
    .addExtension(new CdiCamelExtension());
  // Apply deployment customization provided by the @Beans annotation
  // if present on the test class
  if (test.getJavaClass().isAnnotationPresent(Beans.class)) {
    Beans beans = test.getJavaClass().getAnnotation(Beans.class);
    weld.addExtension(new CamelCdiTestExtension(beans));
    for (Class<?> alternative : beans.alternatives()) {
      // It is not necessary to add the alternative class with WELD-2218
      // anymore, though it's kept for previous versions
      weld.addBeanClass(alternative)
        .addAlternative(alternative);
    }
    for (Class<?> clazz : beans.classes()) {
      weld.addBeanClass(clazz);
    }
    weld.addPackages(false, beans.packages());
  }
}

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

weld.addBeanClass(each);

代码示例来源:origin: org.wildfly.swarm/container

weld.addBeanClass(each);

代码示例来源:origin: io.thorntail/container

weld.addBeanClass(each);

相关文章