Beispiel #1
0
  /**
   * @param beanManager
   * @param beanType
   * @param name
   * @return
   */
  public static <T> T getContextualReference(
      BeanManager beanManager, String name, Class<T> beanType) {

    Set<Bean<?>> beans = beanManager.getBeans(name);

    if (beans == null || beans.isEmpty()) {
      return null;
    }
    return BeanLookupUtils.<T>getContextualReference(beanManager, beanType, beans);
  }
Beispiel #2
0
 /**
  * @param beanManager
  * @param beanTypeLiteral
  * @param qualifiers
  * @return
  */
 public static <T> T getContextualReference(
     BeanManager beanManager, TypeLiteral<T> beanTypeLiteral, Annotation... qualifiers) {
   Type beanType = beanTypeLiteral.getType();
   Set<Bean<?>> beans = getBeans(beanManager, beanType, qualifiers);
   return BeanLookupUtils.<T>getContextualReference(beanManager, beanType, beans);
 }
Beispiel #3
0
 /**
  * @param beanManager
  * @param beanType
  * @param qualifiers
  * @return
  */
 public static <T> T getContextualReference(
     BeanManager beanManager, Class<T> beanType, Annotation... qualifiers) {
   Set<Bean<?>> beans = getBeans(beanManager, beanType, qualifiers);
   return BeanLookupUtils.<T>getContextualReference(beanManager, beanType, beans);
 }