code: @SuppressWarnings("unchecked")
      public static <T> T getBean(BeanManager bm, Class<T> clazz,
                                  Annotation... annotations) {
  
          Bean<?> bean;
  
          if (annotations != null) {
              bean = bm.getBeans(clazz, annotations).iterator().next();
          } else {
              bean = bm.getBeans(clazz, new DefaultLiteral()).iterator().next();
          }
          CreationalContext<?> ctx = bm.createCreationalContext(bean);
          return (T) bm.getReference(bean, clazz, ctx);
      }
docs: Retrieves the bean for the given class from the given bean manager
  qualified with the given annotation(s).
  
  @param <T>               The type of the bean to look for
  @param bm                The bean manager which should be used for the lookup
  @param clazz             The class of the bean to look for
  @param annotationClasses The qualifiers the bean for the given class must have
  @return The bean instance if found, otherwise null