@SuppressWarnings("unchecked")
private static <T> T getReference(Set<Bean<?>> beans, Class<T> beanClass, Annotation... qualifiers) {
if (beans.size() > 1) {
String message = getBundle().getString("ambiguous-bean-resolution", beanClass.getName(), beans.toString());
throw new DemoiselleException(message, new AmbiguousResolutionException());
}
Bean<?> bean = beans.iterator().next();
CreationalContext<?> context = getBeanManager().createCreationalContext(bean);
Type beanType = beanClass == null ? bean.getBeanClass() : beanClass;