Author: swd847
Date: 2010-01-27 20:36:40 -0500 (Wed, 27 Jan 2010)
New Revision: 5648
Modified:
core/trunk/impl/src/main/java/org/jboss/weld/bean/ProducerField.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/ProducerMethod.java
Log:
WELD-335
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/ProducerField.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/ProducerField.java 2010-01-28
00:22:07 UTC (rev 5647)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/ProducerField.java 2010-01-28
01:36:40 UTC (rev 5648)
@@ -29,6 +29,7 @@
import org.jboss.weld.bootstrap.BeanDeployerEnvironment;
import org.jboss.weld.introspector.WeldField;
import org.jboss.weld.manager.BeanManagerImpl;
+import org.jboss.weld.util.AnnotatedTypes;
/**
* Represents a producer field
@@ -64,7 +65,7 @@
*/
protected ProducerField(WeldField<T, X> field, AbstractClassBean<X>
declaringBean, BeanManagerImpl manager)
{
- super(new
StringBuilder().append(ProducerField.class.getSimpleName()).append(BEAN_ID_SEPARATOR).append(declaringBean.getWeldAnnotated().getName()).append(".").append(field.getName()).toString(),
declaringBean, manager);
+ super(createId(field, declaringBean), declaringBean, manager);
this.field = field;
initType();
initTypes();
@@ -72,6 +73,30 @@
initStereotypes();
}
+ protected static String createId(WeldField<?, ?> field,
AbstractClassBean<?> declaringBean)
+ {
+ if (declaringBean.getWeldAnnotated().isDiscovered())
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.append(ProducerField.class.getSimpleName());
+ sb.append(BEAN_ID_SEPARATOR);
+ sb.append(declaringBean.getWeldAnnotated().getName());
+ sb.append(".");
+ sb.append(field.getName());
+ return sb.toString();
+ }
+ else
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.append(ProducerField.class.getSimpleName());
+ sb.append(BEAN_ID_SEPARATOR);
+ sb.append(AnnotatedTypes.createTypeId(declaringBean.getWeldAnnotated()));
+ sb.append(".");
+ sb.append(AnnotatedTypes.createFieldId(field));
+ return sb.toString();
+ }
+ }
+
@Override
public void initialize(BeanDeployerEnvironment environment)
{
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/ProducerMethod.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/ProducerMethod.java 2010-01-28
00:22:07 UTC (rev 5647)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/ProducerMethod.java 2010-01-28
01:36:40 UTC (rev 5648)
@@ -42,6 +42,7 @@
import org.jboss.weld.introspector.WeldMethod;
import org.jboss.weld.introspector.WeldParameter;
import org.jboss.weld.manager.BeanManagerImpl;
+import org.jboss.weld.util.AnnotatedTypes;
import org.jboss.weld.util.reflection.SecureReflections;
/**
@@ -79,11 +80,36 @@
initType();
initTypes();
initQualifiers();
- this.id = new
StringBuilder().append(BEAN_ID_PREFIX).append(getClass().getSimpleName()).append(BEAN_ID_SEPARATOR).append(declaringBean.getWeldAnnotated().getName()).append(getWeldAnnotated().getSignature().toString()).toString();
+ this.id = createId(method, declaringBean);
initStereotypes();
initProducerMethodInjectableParameters();
}
+ protected String createId(WeldMethod<T, X> method, AbstractClassBean<X>
declaringBean)
+ {
+ if (declaringBean.getWeldAnnotated().isDiscovered())
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.append(BEAN_ID_PREFIX);
+ sb.append(ProducerMethod.class.getSimpleName());
+ sb.append(BEAN_ID_SEPARATOR);
+ sb.append(declaringBean.getWeldAnnotated().getName());
+ sb.append(getWeldAnnotated().getSignature().toString());
+ return sb.toString();
+ }
+ else
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.append(BEAN_ID_PREFIX);
+ sb.append(ProducerMethod.class.getSimpleName());
+ sb.append(BEAN_ID_SEPARATOR);
+ sb.append(AnnotatedTypes.createTypeId(declaringBean.getWeldAnnotated()));
+ sb.append(AnnotatedTypes.createCallableId(method));
+ return sb.toString();
+ }
+
+ }
+
/**
* Initializes the bean and its metadata
*/