Author: pete.muir(a)jboss.org
Date: 2009-01-07 08:35:42 -0500 (Wed, 07 Jan 2009)
New Revision: 807
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/EnterpriseBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/NewSimpleBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/SimpleBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java
Log:
Switch to create annotateditem in bootstrap
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-07
13:18:31 UTC (rev 806)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java 2009-01-07
13:35:42 UTC (rev 807)
@@ -40,7 +40,6 @@
import org.jboss.webbeans.introspector.AnnotatedClass;
import org.jboss.webbeans.introspector.AnnotatedField;
import org.jboss.webbeans.introspector.AnnotatedMethod;
-import org.jboss.webbeans.introspector.jlr.AnnotatedClassImpl;
import org.jboss.webbeans.log.LogProvider;
import org.jboss.webbeans.log.Logging;
import org.jboss.webbeans.util.Reflections;
@@ -71,10 +70,10 @@
* @param type The type
* @param manager The Web Beans manager
*/
- public AbstractClassBean(Class<T> type, ManagerImpl manager)
+ public AbstractClassBean(AnnotatedClass<T> type, ManagerImpl manager)
{
super(manager);
- this.annotatedItem = new AnnotatedClassImpl<T>(type);
+ this.annotatedItem = type;
}
/**
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java 2009-01-07
13:18:31 UTC (rev 806)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java 2009-01-07
13:35:42 UTC (rev 807)
@@ -38,9 +38,11 @@
import org.jboss.webbeans.ManagerImpl;
import org.jboss.webbeans.context.DependentContext;
import org.jboss.webbeans.ejb.spi.EjbDescriptor;
+import org.jboss.webbeans.introspector.AnnotatedClass;
import org.jboss.webbeans.introspector.AnnotatedField;
import org.jboss.webbeans.introspector.AnnotatedMethod;
import org.jboss.webbeans.introspector.AnnotatedParameter;
+import org.jboss.webbeans.introspector.jlr.AnnotatedClassImpl;
import org.jboss.webbeans.log.LogProvider;
import org.jboss.webbeans.log.Logging;
@@ -71,6 +73,11 @@
*/
public static <T> EnterpriseBean<T> of(Class<T> clazz, ManagerImpl
manager)
{
+ return of(AnnotatedClassImpl.of(clazz), manager);
+ }
+
+ public static <T> EnterpriseBean<T> of (AnnotatedClass<T> clazz,
ManagerImpl manager)
+ {
return new EnterpriseBean<T>(clazz, manager);
}
@@ -80,7 +87,7 @@
* @param type The type of the bean
* @param manager The Web Beans manager
*/
- protected EnterpriseBean(Class<T> type, ManagerImpl manager)
+ protected EnterpriseBean(AnnotatedClass<T> type, ManagerImpl manager)
{
super(type, manager);
init();
@@ -355,7 +362,7 @@
if (superclass != null)
{
// TODO look up this bean and do this via init
- return new EnterpriseBean(superclass, manager);
+ return (EnterpriseBean) EnterpriseBean.of(superclass, manager);
}
else
{
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/NewSimpleBean.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/NewSimpleBean.java 2009-01-07
13:18:31 UTC (rev 806)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/NewSimpleBean.java 2009-01-07
13:35:42 UTC (rev 807)
@@ -13,20 +13,27 @@
import org.jboss.webbeans.MetaDataCache;
import org.jboss.webbeans.binding.NewBinding;
import org.jboss.webbeans.context.DependentContext;
+import org.jboss.webbeans.introspector.AnnotatedClass;
import org.jboss.webbeans.introspector.AnnotatedField;
import org.jboss.webbeans.introspector.AnnotatedMethod;
+import org.jboss.webbeans.introspector.jlr.AnnotatedClassImpl;
public class NewSimpleBean<T> extends SimpleBean<T>
{
private static Set<Annotation> NEW_BINDING_SET = new
HashSet<Annotation>(Arrays.asList(new NewBinding()));
- public static <T> NewSimpleBean<T> of(Class<T> clazz, ManagerImpl
manager)
+ public static <T> NewSimpleBean<T> of(AnnotatedClass<T> clazz,
ManagerImpl manager)
{
return new NewSimpleBean<T>(clazz, manager);
}
- protected NewSimpleBean(Class<T> type, ManagerImpl manager)
+ public static <T> NewSimpleBean<T> of(Class<T> clazz, ManagerImpl
manager)
{
+ return of(AnnotatedClassImpl.of(clazz), manager);
+ }
+
+ protected NewSimpleBean(AnnotatedClass<T> type, ManagerImpl manager)
+ {
super(type, manager);
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/SimpleBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/SimpleBean.java 2009-01-07
13:18:31 UTC (rev 806)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/SimpleBean.java 2009-01-07
13:35:42 UTC (rev 807)
@@ -32,10 +32,12 @@
import org.jboss.webbeans.MetaDataCache;
import org.jboss.webbeans.context.DependentContext;
import org.jboss.webbeans.injection.InjectionPointImpl;
+import org.jboss.webbeans.introspector.AnnotatedClass;
import org.jboss.webbeans.introspector.AnnotatedConstructor;
import org.jboss.webbeans.introspector.AnnotatedField;
import org.jboss.webbeans.introspector.AnnotatedMethod;
import org.jboss.webbeans.introspector.AnnotatedParameter;
+import org.jboss.webbeans.introspector.jlr.AnnotatedClassImpl;
import org.jboss.webbeans.log.LogProvider;
import org.jboss.webbeans.log.Logging;
import org.jboss.webbeans.util.Names;
@@ -71,6 +73,19 @@
*/
public static <T> SimpleBean<T> of(Class<T> clazz, ManagerImpl
manager)
{
+ return of(AnnotatedClassImpl.of(clazz), manager);
+ }
+
+ /**
+ * Creates a simple, annotation defined Web Bean
+ *
+ * @param <T> The type
+ * @param clazz The class
+ * @param manager the current manager
+ * @return A Web Bean
+ */
+ public static <T> SimpleBean<T> of(AnnotatedClass<T> clazz,
ManagerImpl manager)
+ {
return new SimpleBean<T>(clazz, manager);
}
@@ -80,7 +95,7 @@
* @param type The type of the bean
* @param manager The Web Beans manager
*/
- protected SimpleBean(Class<T> type, ManagerImpl manager)
+ protected SimpleBean(AnnotatedClass<T> type, ManagerImpl manager)
{
super(type, manager);
init();
@@ -386,7 +401,7 @@
if (superclass != null)
{
// TODO look up this bean and do this via init
- return new SimpleBean(superclass, manager);
+ return (SimpleBean) SimpleBean.of(superclass, manager);
}
else
{
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java 2009-01-07
13:18:31 UTC (rev 806)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java 2009-01-07
13:35:42 UTC (rev 807)
@@ -51,9 +51,11 @@
import org.jboss.webbeans.ejb.EJBApiAbstraction;
import org.jboss.webbeans.ejb.spi.EjbResolver;
import org.jboss.webbeans.event.ObserverImpl;
+import org.jboss.webbeans.introspector.AnnotatedClass;
import org.jboss.webbeans.introspector.AnnotatedField;
import org.jboss.webbeans.introspector.AnnotatedItem;
import org.jboss.webbeans.introspector.AnnotatedMethod;
+import org.jboss.webbeans.introspector.jlr.AnnotatedClassImpl;
import org.jboss.webbeans.jsf.JSFApiAbstraction;
import org.jboss.webbeans.log.LogProvider;
import org.jboss.webbeans.log.Logging;
@@ -77,10 +79,10 @@
public static final SimpleBean<ManagerImpl> of(ManagerImpl manager)
{
- return new ManagerBean(ManagerImpl.class, manager);
+ return new ManagerBean(AnnotatedClassImpl.of(ManagerImpl.class), manager);
}
- protected ManagerBean(Class<ManagerImpl> type, ManagerImpl manager)
+ protected ManagerBean(AnnotatedClass<ManagerImpl> type, ManagerImpl manager)
{
super(type, manager);
}
@@ -230,13 +232,14 @@
Set<AbstractBean<?, ?>> beans = new HashSet<AbstractBean<?,
?>>();
for (Class<?> clazz : classes)
{
+ AnnotatedClass<?> annotatedClass = AnnotatedClassImpl.of(clazz);
if (getManager().getEjbDescriptorCache().containsKey(clazz))
{
- createBean(EnterpriseBean.of(clazz, getManager()), beans);
+ createBean(EnterpriseBean.of(annotatedClass, getManager()), beans);
}
else if (isTypeSimpleWebBean(clazz))
{
- createBean(SimpleBean.of(clazz, manager), beans);
+ createBean(SimpleBean.of(annotatedClass, manager), beans);
}
}
return beans;
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java 2009-01-07
13:18:31 UTC (rev 806)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java 2009-01-07
13:35:42 UTC (rev 807)
@@ -345,6 +345,11 @@
}
}
+ public static <T> AnnotatedClass<T> of(Class<T> clazz)
+ {
+ return new AnnotatedClassImpl<T>(clazz);
+ }
+
/**
* Constructor
*