[weld-commits] Weld SVN: r4425 - in core/trunk: impl/src/main/java/org/jboss/weld/introspector and 3 other directories.
weld-commits at lists.jboss.org
weld-commits at lists.jboss.org
Thu Oct 29 17:50:36 EDT 2009
Author: pete.muir at jboss.org
Date: 2009-10-29 17:50:36 -0400 (Thu, 29 Oct 2009)
New Revision: 4425
Modified:
core/trunk/impl/src/main/java/org/jboss/weld/injection/ConstructorInjectionPoint.java
core/trunk/impl/src/main/java/org/jboss/weld/injection/FieldInjectionPoint.java
core/trunk/impl/src/main/java/org/jboss/weld/injection/MethodInjectionPoint.java
core/trunk/impl/src/main/java/org/jboss/weld/injection/ParameterInjectionPoint.java
core/trunk/impl/src/main/java/org/jboss/weld/introspector/WeldConstructor.java
core/trunk/impl/src/main/java/org/jboss/weld/util/Beans.java
core/trunk/tests/src/test/java/org/jboss/weld/test/unit/decorator/simple/SimpleDecorator1.java
core/trunk/tests/src/test/java/org/jboss/weld/test/unit/decorator/simple/SimpleDecorator2.java
core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/simple/SimpleDecorator.java
Log:
use @Inject @Delegate
Modified: core/trunk/impl/src/main/java/org/jboss/weld/injection/ConstructorInjectionPoint.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/injection/ConstructorInjectionPoint.java 2009-10-29 20:12:22 UTC (rev 4424)
+++ core/trunk/impl/src/main/java/org/jboss/weld/injection/ConstructorInjectionPoint.java 2009-10-29 21:50:36 UTC (rev 4425)
@@ -28,11 +28,9 @@
import java.util.List;
import java.util.Set;
-import javax.decorator.Delegate;
import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.inject.spi.Annotated;
import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.inject.spi.Decorator;
import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.introspector.ForwardingWeldConstructor;
@@ -67,7 +65,6 @@
private final Bean<T> declaringBean;
private final WeldConstructor<T> constructor;
- private final boolean delegate;
public static <T> ConstructorInjectionPoint<T> of(Bean<T> declaringBean, WeldConstructor<T> constructor)
{
@@ -78,7 +75,6 @@
{
this.declaringBean = declaringBean;
this.constructor = constructor;
- this.delegate = isAnnotationPresent(Delegate.class) && declaringBean instanceof Decorator<?>;
}
@Override
@@ -196,7 +192,7 @@
public boolean isDelegate()
{
- return delegate;
+ return false;
}
public boolean isTransient()
Modified: core/trunk/impl/src/main/java/org/jboss/weld/injection/FieldInjectionPoint.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/injection/FieldInjectionPoint.java 2009-10-29 20:12:22 UTC (rev 4424)
+++ core/trunk/impl/src/main/java/org/jboss/weld/injection/FieldInjectionPoint.java 2009-10-29 21:50:36 UTC (rev 4425)
@@ -29,6 +29,7 @@
import javax.enterprise.inject.spi.Annotated;
import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.Decorator;
+import javax.inject.Inject;
import org.jboss.interceptor.util.InterceptionUtils;
import org.jboss.weld.BeanManagerImpl;
@@ -53,7 +54,7 @@
{
this.declaringBean = declaringBean;
this.field = field;
- this.delegate = isAnnotationPresent(Delegate.class) && declaringBean instanceof Decorator<?>;
+ this.delegate = isAnnotationPresent(Inject.class) && isAnnotationPresent(Delegate.class) && declaringBean instanceof Decorator<?>;
}
@Override
@@ -67,6 +68,7 @@
return declaringBean;
}
+ @Override
public Set<Annotation> getQualifiers()
{
return delegate().getQualifiers();
Modified: core/trunk/impl/src/main/java/org/jboss/weld/injection/MethodInjectionPoint.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/injection/MethodInjectionPoint.java 2009-10-29 20:12:22 UTC (rev 4424)
+++ core/trunk/impl/src/main/java/org/jboss/weld/injection/MethodInjectionPoint.java 2009-10-29 21:50:36 UTC (rev 4425)
@@ -28,11 +28,9 @@
import java.util.List;
import java.util.Set;
-import javax.decorator.Delegate;
import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.inject.spi.Annotated;
import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.inject.spi.Decorator;
import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.introspector.ForwardingWeldMethod;
@@ -67,7 +65,6 @@
private final Bean<?> declaringBean;
private final WeldMethod<T, X> method;
- private final boolean delegate;
public static <T, X> MethodInjectionPoint<T, X> of(Bean<?> declaringBean, WeldMethod<T, X> method)
{
@@ -78,7 +75,6 @@
{
this.declaringBean = declaringBean;
this.method = method;
- this.delegate = isAnnotationPresent(Delegate.class) && declaringBean instanceof Decorator<?>;
}
@Override
@@ -278,7 +274,7 @@
public boolean isDelegate()
{
- return delegate;
+ return false;
}
public boolean isTransient()
Modified: core/trunk/impl/src/main/java/org/jboss/weld/injection/ParameterInjectionPoint.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/injection/ParameterInjectionPoint.java 2009-10-29 20:12:22 UTC (rev 4424)
+++ core/trunk/impl/src/main/java/org/jboss/weld/injection/ParameterInjectionPoint.java 2009-10-29 21:50:36 UTC (rev 4425)
@@ -63,6 +63,7 @@
return declaringBean;
}
+ @Override
public Set<Annotation> getQualifiers()
{
return delegate().getQualifiers();
Modified: core/trunk/impl/src/main/java/org/jboss/weld/introspector/WeldConstructor.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/introspector/WeldConstructor.java 2009-10-29 20:12:22 UTC (rev 4424)
+++ core/trunk/impl/src/main/java/org/jboss/weld/introspector/WeldConstructor.java 2009-10-29 21:50:36 UTC (rev 4425)
@@ -19,11 +19,9 @@
import java.lang.annotation.Annotation;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
-import java.util.Arrays;
-import java.util.HashSet;
+import java.util.Collections;
import java.util.Set;
-import javax.decorator.Delegate;
import javax.enterprise.inject.spi.AnnotatedConstructor;
/**
@@ -36,7 +34,7 @@
{
@SuppressWarnings("unchecked")
- public static final Set<Class<? extends Annotation>> MAPPED_PARAMETER_ANNOTATIONS = new HashSet<Class<? extends Annotation>>(Arrays.asList(Delegate.class));
+ public static final Set<Class<? extends Annotation>> MAPPED_PARAMETER_ANNOTATIONS = Collections.emptySet();
/**
* Creates a new instance of the class, using this constructor
Modified: core/trunk/impl/src/main/java/org/jboss/weld/util/Beans.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/util/Beans.java 2009-10-29 20:12:22 UTC (rev 4424)
+++ core/trunk/impl/src/main/java/org/jboss/weld/util/Beans.java 2009-10-29 21:50:36 UTC (rev 4425)
@@ -39,7 +39,6 @@
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
-import javax.decorator.Delegate;
import javax.decorator.Decorator;
import javax.enterprise.context.spi.Contextual;
import javax.enterprise.context.spi.CreationalContext;
@@ -169,13 +168,6 @@
addFieldInjectionPoint(annotatedField, fields, declaringBean);
}
}
- for (WeldField<?, ?> annotatedField : t.getAnnotatedWeldFields(Delegate.class))
- {
- if (!annotatedField.isStatic())
- {
- addFieldInjectionPoint(annotatedField, fields, declaringBean);
- }
- }
t = t.getWeldSuperclass();
}
return injectableFieldsList;
Modified: core/trunk/tests/src/test/java/org/jboss/weld/test/unit/decorator/simple/SimpleDecorator1.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/test/unit/decorator/simple/SimpleDecorator1.java 2009-10-29 20:12:22 UTC (rev 4424)
+++ core/trunk/tests/src/test/java/org/jboss/weld/test/unit/decorator/simple/SimpleDecorator1.java 2009-10-29 21:50:36 UTC (rev 4425)
@@ -21,8 +21,9 @@
*/
package org.jboss.weld.test.unit.decorator.simple;
+import javax.decorator.Decorator;
import javax.decorator.Delegate;
-import javax.decorator.Decorator;
+import javax.inject.Inject;
/**
*
@@ -32,7 +33,7 @@
@Decorator
public class SimpleDecorator1
{
- @Delegate
+ @Inject @Delegate
SimpleBean delegate;
public static boolean echo1;
Modified: core/trunk/tests/src/test/java/org/jboss/weld/test/unit/decorator/simple/SimpleDecorator2.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/test/unit/decorator/simple/SimpleDecorator2.java 2009-10-29 20:12:22 UTC (rev 4424)
+++ core/trunk/tests/src/test/java/org/jboss/weld/test/unit/decorator/simple/SimpleDecorator2.java 2009-10-29 21:50:36 UTC (rev 4425)
@@ -21,8 +21,9 @@
*/
package org.jboss.weld.test.unit.decorator.simple;
+import javax.decorator.Decorator;
import javax.decorator.Delegate;
-import javax.decorator.Decorator;
+import javax.inject.Inject;
/**
*
@@ -32,7 +33,7 @@
@Decorator
public class SimpleDecorator2
{
- @Delegate
+ @Inject @Delegate
SimpleBean delegate;
public static boolean echo2;
Modified: core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/simple/SimpleDecorator.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/simple/SimpleDecorator.java 2009-10-29 20:12:22 UTC (rev 4424)
+++ core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/simple/SimpleDecorator.java 2009-10-29 21:50:36 UTC (rev 4425)
@@ -16,10 +16,9 @@
*/
package org.jboss.weld.test.unit.interceptor.simple;
-import org.jboss.weld.test.unit.interceptor.simple.SimpleBean;
-
-import javax.decorator.Delegate;
import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.inject.Inject;
/**
*
@@ -29,7 +28,7 @@
@Decorator
public class SimpleDecorator
{
- @Delegate
+ @Inject @Delegate
SimpleBean delegate;
public String doSomething()
More information about the weld-commits
mailing list