Author: swd847
Date: 2010-06-28 02:23:02 -0400 (Mon, 28 Jun 2010)
New Revision: 6581
Modified:
extensions/trunk/src/main/java/org/jboss/weld/extensions/bean/BeanBuilder.java
Log:
minor enhancements to BeanBuilder
Modified: extensions/trunk/src/main/java/org/jboss/weld/extensions/bean/BeanBuilder.java
===================================================================
---
extensions/trunk/src/main/java/org/jboss/weld/extensions/bean/BeanBuilder.java 2010-06-28
04:42:12 UTC (rev 6580)
+++
extensions/trunk/src/main/java/org/jboss/weld/extensions/bean/BeanBuilder.java 2010-06-28
06:23:02 UTC (rev 6581)
@@ -23,10 +23,12 @@
import javax.enterprise.context.Dependent;
import javax.enterprise.inject.Alternative;
+import javax.enterprise.inject.Default;
import javax.enterprise.inject.spi.AnnotatedType;
import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.BeanManager;
import javax.enterprise.inject.spi.InjectionTarget;
+import javax.enterprise.util.AnnotationLiteral;
import javax.inject.Named;
import org.jboss.weld.extensions.annotated.Annotateds;
@@ -62,7 +64,10 @@
public BeanBuilder<T> defineBeanFromAnnotatedType()
{
- this.injectionTarget = beanManager.createInjectionTarget(type);
+ if (!type.getJavaClass().isInterface())
+ {
+ this.injectionTarget = beanManager.createInjectionTarget(type);
+ }
this.qualifiers = new HashSet<Annotation>();
this.stereotypes = new HashSet<Class<? extends Annotation>>();
for (Annotation annotation : type.getAnnotations())
@@ -100,6 +105,12 @@
{
this.types.add(i);
}
+ if (qualifiers.isEmpty())
+ {
+ qualifiers.add(new AnnotationLiteral<Default>()
+ {
+ });
+ }
this.beanLifecycle = new BeanLifecycleImpl<T>();
this.id = BeanImpl.class.getName() + ":" +
Annotateds.createTypeId(type);
return this;