in deltaspike/core/api/obsolete/src/main/java/org/apache/deltaspike/core/util/bean/BeanBuilder.java [113:176]
public BeanBuilder<T> readFromType(AnnotatedType<T> type)
{
this.beanClass = type.getJavaClass();
if (beanLifecycle == null)
{
setDefaultBeanLifecycle(type);
}
this.qualifiers = new HashSet<Annotation>();
this.stereotypes = new HashSet<Class<? extends Annotation>>();
this.types = new HashSet<Type>();
for (Annotation annotation : type.getAnnotations())
{
if (beanManager.isQualifier(annotation.annotationType()))
{
this.qualifiers.add(annotation);
}
else if (beanManager.isScope(annotation.annotationType()))
{
this.scope = annotation.annotationType();
}
else if (beanManager.isStereotype(annotation.annotationType()))
{
this.stereotypes.add(annotation.annotationType());
}
if (annotation instanceof Named)
{
this.name = ((Named) annotation).value();
if (name == null || name.length() == 0)
{
name = createDefaultBeanName(type);
}
}
if (annotation instanceof Alternative)
{
this.alternative = true;
}
}
if (type.isAnnotationPresent(Typed.class))
{
Typed typed = type.getAnnotation(Typed.class);
this.types.addAll(Arrays.asList(typed.value()));
}
else
{
for (Class<?> c = type.getJavaClass(); c != Object.class && c != null; c = c.getSuperclass())
{
this.types.add(c);
}
Collections.addAll(this.types, type.getJavaClass().getInterfaces());
this.types.add(Object.class);
}
if (qualifiers.isEmpty())
{
qualifiers.add(new DefaultLiteral());
}
qualifiers.add(new AnyLiteral());
this.id = ImmutableBeanWrapper.class.getName() + ":" + Annotateds.createTypeId(type);
return this;
}