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

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

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

Weld.addAlternativeStereotype介绍

[英]Add an alternative stereotype class to the list of selected alternative stereotypes for a synthetic bean archive.

This method does not add any class to the set of bean classes for the synthetic bean archive. It's purpose is solely to compensate the absence of the beans.xml descriptor.
[中]将一个替代原型类添加到合成bean存档的选定替代原型列表中。
此方法不会向合成bean归档的bean类集合添加任何类。它的目的只是为了弥补beans.xml描述符的缺失。

代码示例

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

@SuppressWarnings("unchecked")
@Override
public Weld selectAlternativeStereotypes(Class<? extends Annotation>... alternativeStereotypeClasses) {
  for (Class<? extends Annotation> alternativeStereotypeClass : alternativeStereotypeClasses) {
    addAlternativeStereotype(alternativeStereotypeClass);
  }
  return this;
}

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

@SuppressWarnings("unchecked")
@Override
public Weld selectAlternativeStereotypes(Class<? extends Annotation>... alternativeStereotypeClasses) {
  for (Class<? extends Annotation> alternativeStereotypeClass : alternativeStereotypeClasses) {
    addAlternativeStereotype(alternativeStereotypeClass);
  }
  return this;
}

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

@SuppressWarnings("unchecked")
@Override
public Weld selectAlternativeStereotypes(Class<? extends Annotation>... alternativeStereotypeClasses) {
  for (Class<? extends Annotation> alternativeStereotypeClass : alternativeStereotypeClasses) {
    addAlternativeStereotype(alternativeStereotypeClass);
  }
  return this;
}

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

/**
 * Add alternative stereotype classes to the list of selected alternative stereotypes for the synthetic bean archive.
 * <p>
 * This method does not add any class to the set of bean classes of the synthetic bean archive.
 * </p>
 * @param alternativeStereotypeClasses alternatives stereotypes to select
 * @return self
 */
@SuppressWarnings("unchecked")
public Weld selectAlternativeStereotypes(Class<? extends Annotation>... alternativeStereotypeClasses) {
  for (Class<? extends Annotation> clazz : alternativeStereotypeClasses) {
    addAlternativeStereotype(clazz);
  }
  return this;
}

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

/**
 * Select alternative stereotypes for the synthetic bean archive, all previous values are removed.
 * <p>
 * This method does not add any class to the set of bean classes for the synthetic bean archive. It's purpose is solely to compensate the absence of the
 * <code>beans.xml</code> descriptor.
 *
 * @param alternativeStereotypeClasses
 * @return self
 */
@SafeVarargs
public final Weld alternativeStereotypes(Class<? extends Annotation>... alternativeStereotypeClasses) {
  selectedAlternativeStereotypes.clear();
  for (Class<? extends Annotation> alternativeStereotypeClass : alternativeStereotypeClasses) {
    addAlternativeStereotype(alternativeStereotypeClass);
  }
  return this;
}

代码示例来源: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()));
}

相关文章