Author: nickarls
Date: 2009-01-05 06:12:27 -0500 (Mon, 05 Jan 2009)
New Revision: 765
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java
Log:
move producer checks one level up
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java 2009-01-05
09:50:09 UTC (rev 764)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java 2009-01-05
11:12:27 UTC (rev 765)
@@ -30,16 +30,19 @@
import javax.webbeans.Dependent;
import javax.webbeans.DeploymentType;
import javax.webbeans.Event;
+import javax.webbeans.IllegalProductException;
import javax.webbeans.Named;
import javax.webbeans.ScopeType;
import javax.webbeans.Specializes;
import javax.webbeans.Standard;
import javax.webbeans.Stereotype;
+import javax.webbeans.UnserializableDependencyException;
import javax.webbeans.manager.Bean;
import org.jboss.webbeans.ManagerImpl;
import org.jboss.webbeans.binding.CurrentBinding;
import org.jboss.webbeans.introspector.AnnotatedItem;
+import org.jboss.webbeans.introspector.jlr.AbstractAnnotatedMember;
import org.jboss.webbeans.introspector.jlr.AbstractAnnotatedItem.AnnotationMap;
import org.jboss.webbeans.log.LogProvider;
import org.jboss.webbeans.log.Logging;
@@ -263,6 +266,40 @@
this.primitive = Reflections.isPrimitive(getType());
}
+ protected void checkProducedInjectionPoints()
+ {
+ for (AnnotatedItem<?, ?> injectionPoint : getInjectionPoints())
+ {
+ if (injectionPoint instanceof AbstractAnnotatedMember)
+ {
+ if (((AbstractAnnotatedMember<?, ?>) injectionPoint).isTransient())
+ {
+ continue;
+ }
+ }
+ Annotation[] bindings =
injectionPoint.getMetaAnnotationsAsArray(BindingType.class);
+ Bean<?> bean = manager.resolveByType(injectionPoint.getType(),
bindings).iterator().next();
+ boolean producerBean = (bean instanceof ProducerMethodBean || bean instanceof
ProducerFieldBean);
+ if (producerBean && Dependent.class.equals(bean.getScopeType())
&& !bean.isSerializable())
+ {
+ throw new IllegalProductException("Dependent-scoped producer bean "
+ producerBean + " produces a non-serializable product for injection for " +
injectionPoint + " in " + this);
+ }
+ }
+ }
+
+ protected void checkInjectionPoints()
+ {
+ for (AnnotatedItem<?, ?> injectionPoint : getInjectionPoints())
+ {
+ Annotation[] bindings =
injectionPoint.getMetaAnnotationsAsArray(BindingType.class);
+ Bean<?> bean = manager.resolveByType(injectionPoint.getType(),
bindings).iterator().next();
+ if (Dependent.class.equals(bean.getScopeType()) &&
!bean.isSerializable())
+ {
+ throw new UnserializableDependencyException(bean + " is a
non-serializable dependent injection for " + injectionPoint + " in " +
this);
+ }
+ }
+ }
+
/**
* Initializes the scope type
*/
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java 2009-01-05
09:50:09 UTC (rev 764)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java 2009-01-05
11:12:27 UTC (rev 765)
@@ -338,37 +338,4 @@
return Production.class;
}
- protected void checkProducedInjectionPoints()
- {
- for (AnnotatedItem<?, ?> injectionPoint : getInjectionPoints())
- {
- if (injectionPoint instanceof AbstractAnnotatedMember)
- {
- if (((AbstractAnnotatedMember<?, ?>) injectionPoint).isTransient())
- {
- continue;
- }
- }
- Annotation[] bindings =
injectionPoint.getMetaAnnotationsAsArray(BindingType.class);
- Bean<?> bean = manager.resolveByType(injectionPoint.getType(),
bindings).iterator().next();
- boolean producerBean = (bean instanceof ProducerMethodBean || bean instanceof
ProducerFieldBean);
- if (producerBean && Dependent.class.equals(bean.getScopeType())
&& !bean.isSerializable())
- {
- throw new IllegalProductException("Dependent-scoped producer bean "
+ producerBean + " produces a non-serializable product for injection for " +
injectionPoint + " in " + this);
- }
- }
- }
-
- protected void checkInjectionPoints()
- {
- for (AnnotatedItem<?, ?> injectionPoint : getInjectionPoints())
- {
- Annotation[] bindings =
injectionPoint.getMetaAnnotationsAsArray(BindingType.class);
- Bean<?> bean = manager.resolveByType(injectionPoint.getType(),
bindings).iterator().next();
- if (Dependent.class.equals(bean.getScopeType()) &&
!bean.isSerializable())
- {
- throw new UnserializableDependencyException(bean + " is a
non-serializable dependent injection for " + injectionPoint + " in " +
this);
- }
- }
- }
}
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java 2009-01-05
09:50:09 UTC (rev 764)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java 2009-01-05
11:12:27 UTC (rev 765)
@@ -176,19 +176,6 @@
return getAnnotatedItem().isStatic() ? null :
manager.getInstance(getDeclaringBean());
}
- protected void checkInjectionPoints()
- {
- for (AnnotatedItem<?, ?> injectionPoint : getInjectionPoints())
- {
- Annotation[] bindings =
injectionPoint.getMetaAnnotationsAsArray(BindingType.class);
- Bean<?> bean = manager.resolveByType(injectionPoint.getType(),
bindings).iterator().next();
- if (Dependent.class.equals(bean.getScopeType()) &&
!bean.isSerializable())
- {
- throw new UnserializableDependencyException(bean + " is a
non-serializable dependent injection for " + injectionPoint + " in " +
this);
- }
- }
- }
-
/**
* Creates an instance of the bean
*
@@ -229,27 +216,6 @@
}
}
- protected void checkProducedInjectionPoints()
- {
- for (AnnotatedItem<?, ?> injectionPoint : getInjectionPoints())
- {
- if (injectionPoint instanceof AbstractAnnotatedMember)
- {
- if (((AbstractAnnotatedMember<?, ?>) injectionPoint).isTransient())
- {
- continue;
- }
- }
- Annotation[] bindings =
injectionPoint.getMetaAnnotationsAsArray(BindingType.class);
- Bean<?> bean = manager.resolveByType(injectionPoint.getType(),
bindings).iterator().next();
- boolean producerBean = (bean instanceof ProducerMethodBean || bean instanceof
ProducerFieldBean);
- if (producerBean && Dependent.class.equals(bean.getScopeType())
&& !bean.isSerializable())
- {
- throw new IllegalProductException("Dependent-scoped producer bean "
+ producerBean + " produces a non-serializable product for injection for " +
injectionPoint + " in " + this);
- }
- }
- }
-
protected abstract T produceInstance();
/**
Show replies by date