[webbeans-commits] Webbeans SVN: r297 - in ri/trunk/webbeans-ri/src: main/java/org/jboss/webbeans/bean and 10 other directories.
webbeans-commits at lists.jboss.org
webbeans-commits at lists.jboss.org
Thu Nov 13 04:42:15 EST 2008
Author: pete.muir at jboss.org
Date: 2008-11-13 04:42:14 -0500 (Thu, 13 Nov 2008)
New Revision: 297
Added:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ForwardingBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/ForwardingAnnotatedItem.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/invalid/GreatDane.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/invalid/GreaterDane.java
Removed:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/BeanWrapper.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/exceptions/TypesafeResolutionLocation.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/ForwardingInjectableMethod.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/ForwardingInjectableParameter.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/Injectable.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/InjectableField.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/InjectableMethod.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/InjectableParameter.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/InjectableWrapper.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/Invokable.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/ResolverInjectable.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/stereotypes/
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/valid/GreatDane.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/valid/GreaterDane.java
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ModelManager.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ResolutionManager.java
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/EnterpriseBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EventBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/SimpleBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ejb/DefaultEnterpriseBeanLookup.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ejb/EjbMetaData.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/ObserverImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedAnnotation.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedClass.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedConstructor.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedField.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedItem.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedMethod.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedType.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/AbstractAnnotatedItem.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/AbstractAnnotatedMember.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/AbstractAnnotatedType.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/SimpleAnnotatedAnnotation.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/SimpleAnnotatedClass.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/SimpleAnnotatedConstructor.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/SimpleAnnotatedField.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/SimpleAnnotatedMethod.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/BindingTypeTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ClassAnnotatedItemTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeferredEventNotificationTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeploymentTypeTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InstantiationByNameTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InstantiationByTypeTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NameTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NormalContextTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ObserverTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ResolutionByTypeTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ScopeTypeTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleBeanModelTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/StereotypesTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/EnterpriseBeanDeclarationTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/EnterpriseBeanRemoveMethodTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/EnterpriseBeanSpecializationTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockObserverImpl.java
Log:
Merge behaviour into annotated*
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java 2008-11-12 21:09:31 UTC (rev 296)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java 2008-11-13 09:42:14 UTC (rev 297)
@@ -1,7 +1,6 @@
package org.jboss.webbeans;
import java.lang.annotation.Annotation;
-import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
@@ -12,9 +11,11 @@
import java.util.concurrent.CopyOnWriteArrayList;
import javax.webbeans.AmbiguousDependencyException;
+import javax.webbeans.BindingType;
import javax.webbeans.ContextNotActiveException;
import javax.webbeans.Dependent;
import javax.webbeans.DeploymentException;
+import javax.webbeans.DuplicateBindingTypeException;
import javax.webbeans.Observer;
import javax.webbeans.Production;
import javax.webbeans.Standard;
@@ -29,7 +30,6 @@
import javax.webbeans.manager.Manager;
import org.jboss.webbeans.bean.SimpleBean;
-import org.jboss.webbeans.bean.proxy.ClientProxy;
import org.jboss.webbeans.bean.proxy.ProxyPool;
import org.jboss.webbeans.contexts.ApplicationContext;
import org.jboss.webbeans.contexts.DependentContext;
@@ -38,9 +38,9 @@
import org.jboss.webbeans.ejb.DefaultEnterpriseBeanLookup;
import org.jboss.webbeans.event.EventBus;
import org.jboss.webbeans.exceptions.NameResolutionLocation;
-import org.jboss.webbeans.exceptions.TypesafeResolutionLocation;
-import org.jboss.webbeans.introspector.impl.Injectable;
-import org.jboss.webbeans.introspector.impl.ResolverInjectable;
+import org.jboss.webbeans.introspector.AnnotatedItem;
+import org.jboss.webbeans.introspector.AnnotatedMethod;
+import org.jboss.webbeans.introspector.impl.SimpleAnnotatedClass;
import org.jboss.webbeans.util.Reflections;
import com.google.common.collect.ForwardingMap;
@@ -74,6 +74,8 @@
return delegate;
}
}
+
+
private List<Class<? extends Annotation>> enabledDeploymentTypes;
private ModelManager modelManager;
@@ -152,9 +154,9 @@
}
- public <T> Set<Method> resolveDisposalMethods(Class<T> apiType, Annotation... bindingTypes)
+ public <T> Set<AnnotatedMethod<Object>> resolveDisposalMethods(Class<T> apiType, Annotation... bindingTypes)
{
- return new HashSet<Method>();
+ return new HashSet<AnnotatedMethod<Object>>();
}
public <T> Set<Observer<T>> resolveObservers(T event, Annotation... bindings)
@@ -174,27 +176,33 @@
public <T> Set<Bean<T>> resolveByType(Class<T> type, Annotation... bindingTypes)
{
- return resolveByType(new ResolverInjectable<T>(type, bindingTypes, getModelManager()));
+ return resolveByType(new SimpleAnnotatedClass<T>(type, type, bindingTypes), bindingTypes);
}
- public <T> Set<Bean<T>> resolveByType(TypeLiteral<T> apiType, Annotation... bindingTypes)
+ public <T> Set<Bean<T>> resolveByType(TypeLiteral<T> type, Annotation... bindingTypes)
{
- return resolveByType(new ResolverInjectable<T>(apiType, bindingTypes, getModelManager()));
+ return resolveByType(new SimpleAnnotatedClass<T>(type.getRawType(), type.getType(), bindingTypes), bindingTypes);
}
-
- private <T> Set<Bean<T>> resolveByType(Injectable<T, ?> injectable)
+
+ public <T> Set<Bean<T>> resolveByType(AnnotatedItem<T, ?> element, Annotation... bindingTypes)
{
- Set<Bean<T>> beans = getResolutionManager().get(injectable);
-
- if (beans == null)
+ checkBindingAnnotations(element, bindingTypes);
+ return getResolutionManager().get(element);
+ }
+
+ private void checkBindingAnnotations(AnnotatedItem<?, ?> element, Annotation... bindingTypes)
+ {
+ for (Annotation annotation : element.getAnnotations())
{
- return new HashSet<Bean<T>>();
+ if (!modelManager.getBindingTypeModel(annotation.annotationType()).isValid())
+ {
+ throw new IllegalArgumentException("Not a binding type " + annotation);
+ }
}
- else
+ if (bindingTypes.length > element.getAnnotations(BindingType.class).size())
{
- return beans;
+ throw new DuplicateBindingTypeException(element.toString());
}
-
}
public ResolutionManager getResolutionManager()
@@ -337,31 +345,31 @@
public <T> T getInstanceByType(Class<T> type, Annotation... bindingTypes)
{
- return getInstanceByType(new ResolverInjectable<T>(type, bindingTypes, getModelManager()));
+ return getInstanceByType(new SimpleAnnotatedClass<T>(type, type, bindingTypes), bindingTypes);
}
public <T> T getInstanceByType(TypeLiteral<T> type, Annotation... bindingTypes)
{
- return getInstanceByType(new ResolverInjectable<T>(type, bindingTypes, getModelManager()));
+ return getInstanceByType(new SimpleAnnotatedClass<T>(type.getRawType(), type.getType(), bindingTypes), bindingTypes);
}
- private <T> T getInstanceByType(Injectable<T, ?> injectable)
+ public <T> T getInstanceByType(AnnotatedItem<T, ?> element, Annotation... bindingTypes)
{
- Set<Bean<T>> beans = resolveByType(injectable);
+ Set<Bean<T>> beans = resolveByType(element, bindingTypes);
if (beans.size() == 0)
{
- throw new UnsatisfiedDependencyException(new TypesafeResolutionLocation(injectable) + "Unable to resolve any Web Beans");
+ throw new UnsatisfiedDependencyException(element + "Unable to resolve any Web Beans");
}
else if (beans.size() > 1)
{
- throw new AmbiguousDependencyException(new TypesafeResolutionLocation(injectable) + "Resolved multiple Web Beans");
+ throw new AmbiguousDependencyException(element + "Resolved multiple Web Beans");
}
else
{
Bean<T> bean = beans.iterator().next();
- if (getModelManager().getScopeModel(bean.getScopeType()).isNormal() && !ClientProxy.isProxyable(injectable.getType()))
+ if (getModelManager().getScopeModel(bean.getScopeType()).isNormal() && !element.isProxyable())
{
- throw new UnproxyableDependencyException(new TypesafeResolutionLocation(injectable) + "Unable to proxy");
+ throw new UnproxyableDependencyException(element + "Unable to proxy");
}
else
{
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ModelManager.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ModelManager.java 2008-11-12 21:09:31 UTC (rev 296)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ModelManager.java 2008-11-13 09:42:14 UTC (rev 297)
@@ -4,6 +4,8 @@
import java.util.HashMap;
import java.util.Map;
+import org.jboss.webbeans.ejb.EjbMetaData;
+import org.jboss.webbeans.introspector.AnnotatedClass;
import org.jboss.webbeans.model.AnnotationModel;
import org.jboss.webbeans.model.BindingTypeModel;
import org.jboss.webbeans.model.ScopeModel;
@@ -82,12 +84,43 @@
}
+ private class EjbMetaDataMap extends ForwardingMap<AnnotatedClass<?>, EjbMetaData<?>>
+ {
+
+ private Map<AnnotatedClass<?>, EjbMetaData<?>> delegate;
+
+ public EjbMetaDataMap()
+ {
+ delegate = new HashMap<AnnotatedClass<?>, EjbMetaData<?>>();
+ }
+
+ @Override
+ protected Map<AnnotatedClass<?>, EjbMetaData<?>> delegate()
+ {
+ return delegate;
+ }
+
+ public <T> EjbMetaData<T> putIfAbsent(AnnotatedClass<T> key)
+ {
+ if (!containsKey(key))
+ {
+ EjbMetaData<T> ejbMetaData = new EjbMetaData<T>(key);
+ super.put(key, ejbMetaData);
+ return ejbMetaData;
+ }
+ return (EjbMetaData<T>) super.get(key);
+ }
+
+ }
+
private Map<Class<? extends Annotation>, StereotypeModel<?>> stereotypes = new HashMap<Class<? extends Annotation>, StereotypeModel<?>>();
private ScopeModelMap scopes = new ScopeModelMap();
private BindingTypeModelMap bindingTypes = new BindingTypeModelMap();
+ private EjbMetaDataMap ejbMetaDataMap = new EjbMetaDataMap();
+
public void addStereotype(StereotypeModel<?> stereotype)
{
@@ -109,6 +142,9 @@
return bindingTypes.putIfAbsent(bindingType);
}
-
+ public <E> EjbMetaData<E> getEjbMetaData(AnnotatedClass<E> clazz)
+ {
+ return ejbMetaDataMap.putIfAbsent(clazz);
+ }
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ResolutionManager.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ResolutionManager.java 2008-11-12 21:09:31 UTC (rev 296)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ResolutionManager.java 2008-11-13 09:42:14 UTC (rev 297)
@@ -13,7 +13,9 @@
import javax.webbeans.NullableDependencyException;
import javax.webbeans.manager.Bean;
-import org.jboss.webbeans.introspector.impl.Injectable;
+import org.jboss.webbeans.introspector.AnnotatedItem;
+import org.jboss.webbeans.introspector.ForwardingAnnotatedItem;
+import org.jboss.webbeans.model.BindingTypeModel;
import org.jboss.webbeans.util.ListComparator;
import com.google.common.collect.ForwardingMap;
@@ -21,27 +23,54 @@
public class ResolutionManager
{
+ private abstract class ResolvableAnnotatedItem<T, S> extends ForwardingAnnotatedItem<T, S>
+ {
+
+ @Override
+ public boolean equals(Object other)
+ {
+ // TODO Do we need to check the other direction too?
+ if (other instanceof AnnotatedItem)
+ {
+ AnnotatedItem<?, ?> that = (AnnotatedItem<?, ?>) other;
+ return delegate().isAssignableFrom(that) &&
+ that.getBindingTypes().equals(this.getBindingTypes());
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return delegate().hashCode();
+ }
+
+ }
+
// TODO Why can't we generify Set?
@SuppressWarnings("unchecked")
- private class InjectableMap extends ForwardingMap<Injectable<?, ?>, Set>
+ private class AnnotatedItemMap extends ForwardingMap<AnnotatedItem<?, ?>, Set>
{
- private Map<Injectable<?, ?>, Set> delegate;
+ private Map<AnnotatedItem<?, ?>, Set> delegate;
- public InjectableMap()
+ public AnnotatedItemMap()
{
- delegate = new HashMap<Injectable<?, ?>, Set>();
+ delegate = new HashMap<AnnotatedItem<?, ?>, Set>();
}
@SuppressWarnings("unchecked")
- public <T> Set<Bean<T>> get(Injectable<T, ?> key)
+ public <T> Set<Bean<T>> get(AnnotatedItem<T, ?> key)
{
return (Set<Bean<T>>) super.get(key);
}
@Override
- protected Map<Injectable<?, ?>, Set> delegate()
+ protected Map<AnnotatedItem<?, ?>, Set> delegate()
{
return delegate;
}
@@ -49,8 +78,8 @@
}
- private InjectableMap resolvedInjectionPoints;
- private Set<Injectable<?, ?>> injectionPoints;
+ private AnnotatedItemMap resolvedInjectionPoints;
+ private Set<AnnotatedItem<?, ?>> injectionPoints;
private Map<String, Set<Bean<?>>> resolvedNames;
@@ -58,20 +87,20 @@
public ResolutionManager(ManagerImpl manager)
{
- this.injectionPoints = new HashSet<Injectable<?,?>>();
- this.resolvedInjectionPoints = new InjectableMap();
+ this.injectionPoints = new HashSet<AnnotatedItem<?,?>>();
+ this.resolvedInjectionPoints = new AnnotatedItemMap();
this.manager = manager;
}
- public void addInjectionPoint(Injectable<?, ?> injectable)
+ public <T, S> void addInjectionPoint(final AnnotatedItem<T, S> element)
{
- injectionPoints.add(injectable);
+ injectionPoints.add(element);
}
- private void registerInjectionPoint(Injectable<?, ?> injectable)
+ private <T, S> void registerInjectionPoint(final AnnotatedItem<T, S> element)
{
- Set<Bean<?>> beans = retainHighestPrecedenceBeans(injectable.getMatchingBeans(manager.getBeans(), manager.getModelManager()), manager.getEnabledDeploymentTypes());
- if (injectable.getType().isPrimitive())
+ Set<Bean<?>> beans = retainHighestPrecedenceBeans(getMatchingBeans(element, manager.getBeans(), manager.getModelManager()), manager.getEnabledDeploymentTypes());
+ if (element.getType().isPrimitive())
{
for (Bean<?> bean : beans)
{
@@ -81,38 +110,60 @@
}
}
}
- resolvedInjectionPoints.put(injectable, beans);
+ resolvedInjectionPoints.put(new ResolvableAnnotatedItem<T, S>()
+ {
+
+ @Override
+ public AnnotatedItem<T, S> delegate()
+ {
+ return element;
+ }
+
+ }, beans);
}
public void clear()
{
- resolvedInjectionPoints = new InjectableMap();
+ resolvedInjectionPoints = new AnnotatedItemMap();
resolvedNames = new HashMap<String, Set<Bean<?>>>();
}
public void resolveInjectionPoints()
{
- for (Injectable<?, ?> injectable : injectionPoints)
+ for (AnnotatedItem<?, ?> injectable : injectionPoints)
{
registerInjectionPoint(injectable);
}
}
- public <T> Set<Bean<T>> get(Injectable<T, ?> key)
+ public <T, S> Set<Bean<T>> get(final AnnotatedItem<T, S> key)
{
- Set<Bean<T>> beans;
- if (key.getType().equals(Object.class))
+ Set<Bean<T>> beans = new HashSet<Bean<T>>();
+
+ AnnotatedItem<T, S> element = new ResolvableAnnotatedItem<T, S>()
{
+
+ @Override
+ public AnnotatedItem<T, S> delegate()
+ {
+ return key;
+ }
+
+ };
+
+ // TODO We don't need this I think
+ if (element.getType().equals(Object.class))
+ {
// TODO Fix this cast
beans = new HashSet<Bean<T>>((List) manager.getBeans());
}
else
{
- if (!resolvedInjectionPoints.containsKey(key))
+ if (!resolvedInjectionPoints.containsKey(element))
{
- registerInjectionPoint(key);
+ registerInjectionPoint(element);
}
- beans = resolvedInjectionPoints.get(key);
+ beans = resolvedInjectionPoints.get(element);
}
return Collections.unmodifiableSet(beans);
}
@@ -171,5 +222,46 @@
return beans;
}
}
+
+ private static Set<Bean<?>> getMatchingBeans(AnnotatedItem<?, ?> element, List<Bean<?>> beans, ModelManager modelManager)
+ {
+ Set<Bean<?>> resolvedBeans = new HashSet<Bean<?>>();
+ for (Bean<?> bean : beans)
+ {
+ if (element.isAssignableFrom(bean.getTypes()) && containsAllBindingBindingTypes(element, bean.getBindingTypes(), modelManager))
+ {
+ resolvedBeans.add(bean);
+ }
+ }
+ return resolvedBeans;
+ }
+
+ private static boolean containsAllBindingBindingTypes(AnnotatedItem<?, ?> element, Set<Annotation> bindingTypes, ModelManager modelManager)
+ {
+ for (Annotation bindingType : element.getBindingTypes())
+ {
+ BindingTypeModel<?> bindingTypeModel = modelManager.getBindingTypeModel(bindingType.annotationType());
+ if (bindingTypeModel.getNonBindingTypes().size() > 0)
+ {
+ boolean matchFound = false;
+ for (Annotation otherBindingType : bindingTypes)
+ {
+ if (bindingTypeModel.isEqual(bindingType, otherBindingType))
+ {
+ matchFound = true;
+ }
+ }
+ if (!matchFound)
+ {
+ return false;
+ }
+ }
+ else if (!bindingTypes.contains(bindingType))
+ {
+ return false;
+ }
+ }
+ return true;
+ }
}
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 2008-11-12 21:09:31 UTC (rev 296)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java 2008-11-13 09:42:14 UTC (rev 297)
@@ -25,9 +25,8 @@
import org.jboss.webbeans.bindings.CurrentAnnotationLiteral;
import org.jboss.webbeans.ejb.DefaultEnterpriseBeanLookup;
import org.jboss.webbeans.introspector.AnnotatedItem;
-import org.jboss.webbeans.introspector.impl.Injectable;
-import org.jboss.webbeans.introspector.impl.InjectableMethod;
-import org.jboss.webbeans.introspector.impl.InjectableParameter;
+import org.jboss.webbeans.introspector.AnnotatedMethod;
+import org.jboss.webbeans.introspector.AnnotatedParameter;
import org.jboss.webbeans.log.LogProvider;
import org.jboss.webbeans.log.Logging;
import org.jboss.webbeans.util.Reflections;
@@ -60,9 +59,9 @@
private MergedStereotypes<T, E> mergedStereotypes;
protected Class<? extends Annotation> deploymentType;
protected Class<T> type;
- protected InjectableMethod<?> removeMethod;
+ protected AnnotatedMethod<Object> removeMethod;
protected Set<Class<?>> apiTypes;
- protected Set<Injectable<?, ?>> injectionPoints;
+ protected Set<AnnotatedItem<?, ?>> injectionPoints;
private boolean primitive;
@@ -183,10 +182,10 @@
protected void initInjectionPoints()
{
- injectionPoints = new HashSet<Injectable<?,?>>();
+ injectionPoints = new HashSet<AnnotatedItem<?,?>>();
if (removeMethod != null)
{
- for (InjectableParameter<?> injectable : removeMethod.getParameters())
+ for (AnnotatedParameter<?> injectable : removeMethod.getParameters())
{
injectionPoints.add(injectable);
}
@@ -368,7 +367,7 @@
return deploymentType;
}
- public Set<Injectable<?, ?>> getInjectionPoints()
+ public Set<AnnotatedItem<?, ?>> getInjectionPoints()
{
return injectionPoints;
}
@@ -389,7 +388,7 @@
return name;
}
- public InjectableMethod<?> getRemoveMethod()
+ public AnnotatedMethod<?> getRemoveMethod()
{
return removeMethod;
}
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 2008-11-12 21:09:31 UTC (rev 296)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java 2008-11-13 09:42:14 UTC (rev 297)
@@ -15,8 +15,6 @@
import org.jboss.webbeans.introspector.AnnotatedClass;
import org.jboss.webbeans.introspector.AnnotatedField;
import org.jboss.webbeans.introspector.AnnotatedMethod;
-import org.jboss.webbeans.introspector.impl.InjectableField;
-import org.jboss.webbeans.introspector.impl.InjectableMethod;
import org.jboss.webbeans.introspector.impl.SimpleAnnotatedClass;
import org.jboss.webbeans.log.LogProvider;
import org.jboss.webbeans.log.Logging;
@@ -29,9 +27,8 @@
private static final LogProvider log = Logging.getLogProvider(AbstractClassBean.class);
private AnnotatedClass<T> annotatedItem;
- private Set<InjectableField<?>> injectableFields;
- private Set<InjectableMethod<Object>> initializerMethods;
- protected boolean annotationDefined;
+ private Set<AnnotatedField<Object>> injectableFields;
+ private Set<AnnotatedMethod<Object>> initializerMethods;
/**
*
@@ -73,7 +70,7 @@
protected void initInjectionPoints()
{
super.initInjectionPoints();
- injectableFields = new HashSet<InjectableField<?>>();
+ injectableFields = new HashSet<AnnotatedField<Object>>();
for (AnnotatedField<Object> annotatedField : annotatedItem.getMetaAnnotatedFields(BindingType.class))
{
if (annotatedField.isStatic())
@@ -84,9 +81,8 @@
{
throw new DefinitionException("Don't place binding annotations on final fields " + annotatedField);
}
- InjectableField<?> injectableField = new InjectableField<Object>(annotatedField);
- injectableFields.add(injectableField);
- super.injectionPoints.add(injectableField);
+ injectableFields.add(annotatedField);
+ super.injectionPoints.add(annotatedField);
}
}
@@ -98,7 +94,7 @@
}
else
{
- initializerMethods = new HashSet<InjectableMethod<Object>>();
+ initializerMethods = new HashSet<AnnotatedMethod<Object>>();
for (AnnotatedMethod<Object> annotatedMethod : annotatedItem.getAnnotatedMethods(Initializer.class))
{
if (annotatedMethod.isStatic())
@@ -123,7 +119,7 @@
}
else
{
- initializerMethods.add(new InjectableMethod<Object>(annotatedMethod));
+ initializerMethods.add(annotatedMethod);
}
}
}
@@ -179,12 +175,12 @@
return name;
}
- public Set<InjectableField<?>> getInjectableFields()
+ public Set<AnnotatedField<Object>> getInjectableFields()
{
return injectableFields;
}
- public Set<InjectableMethod<Object>> getInitializerMethods()
+ public Set<AnnotatedMethod<Object>> getInitializerMethods()
{
return initializerMethods;
}
Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/BeanWrapper.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/BeanWrapper.java 2008-11-12 21:09:31 UTC (rev 296)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/BeanWrapper.java 2008-11-13 09:42:14 UTC (rev 297)
@@ -1,92 +0,0 @@
-package org.jboss.webbeans.bean;
-
-import java.lang.annotation.Annotation;
-import java.util.Set;
-
-import javax.webbeans.manager.Bean;
-import javax.webbeans.manager.Manager;
-
-public class BeanWrapper<T> extends Bean<T>
-{
-
- private Bean<T> delegate;
-
- public BeanWrapper(Manager manager, Bean<T> delegate)
- {
- super(manager);
- this.delegate = delegate;
- }
-
- @Override
- public T create()
- {
- return delegate.create();
- }
-
- @Override
- public void destroy(T instance)
- {
- delegate.destroy(instance);
- }
-
- @Override
- public Set<Annotation> getBindingTypes()
- {
- return delegate.getBindingTypes();
- }
-
- @Override
- public Class<? extends Annotation> getDeploymentType()
- {
- return delegate.getDeploymentType();
- }
-
- @Override
- public String getName()
- {
- return delegate.getName();
- }
-
- @Override
- public Class<? extends Annotation> getScopeType()
- {
- return delegate.getScopeType();
- }
-
- @Override
- public Set<Class<?>> getTypes()
- {
- return delegate.getTypes();
- }
-
- @Override
- public boolean isNullable()
- {
- return delegate.isNullable();
- }
-
- @Override
- public boolean isSerializable()
- {
- return delegate.isSerializable();
- }
-
- @Override
- public String toString()
- {
- return delegate.toString();
- }
-
- @Override
- public int hashCode()
- {
- return delegate.hashCode();
- }
-
- @Override
- public boolean equals(Object obj)
- {
- return delegate.equals(obj);
- }
-
-}
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 2008-11-12 21:09:31 UTC (rev 296)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java 2008-11-13 09:42:14 UTC (rev 297)
@@ -1,8 +1,5 @@
package org.jboss.webbeans.bean;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Method;
-
import javax.webbeans.ApplicationScoped;
import javax.webbeans.Decorator;
import javax.webbeans.DefinitionException;
@@ -19,9 +16,9 @@
import org.jboss.webbeans.ManagerImpl;
import org.jboss.webbeans.ejb.EJB;
import org.jboss.webbeans.ejb.EjbMetaData;
-import org.jboss.webbeans.introspector.impl.InjectableField;
-import org.jboss.webbeans.introspector.impl.InjectableMethod;
-import org.jboss.webbeans.introspector.impl.InjectableParameter;
+import org.jboss.webbeans.introspector.AnnotatedField;
+import org.jboss.webbeans.introspector.AnnotatedMethod;
+import org.jboss.webbeans.introspector.AnnotatedParameter;
public class EnterpriseBean<T> extends AbstractClassBean<T>
{
@@ -47,6 +44,7 @@
checkEnterpriseScopeAllowed();
checkConflictingRoles();
checkSpecialization();
+ checkRemoveMethod();
}
@Override
@@ -55,7 +53,7 @@
super.initInjectionPoints();
if (removeMethod != null)
{
- for (InjectableParameter<?> injectable : removeMethod.getParameters())
+ for (AnnotatedParameter<?> injectable : removeMethod.getParameters())
{
injectionPoints.add(injectable);
}
@@ -109,15 +107,16 @@
{
return;
}
- if (annotationDefined)
+ if (!isDefinedInXml())
{
- if (!isEJB(getType().getSuperclass()))
+ if (!getManager().getModelManager().getEjbMetaData(getAnnotatedItem().getSuperclass()).isEjb())
{
throw new DefinitionException("Annotation defined specializing EJB must have EJB superclass");
}
- } else
+ }
+ else
{
- if (!isEJB(getType()))
+ if (getManager().getModelManager().getEjbMetaData(getAnnotatedItem().getSuperclass()).isEjb())
{
throw new DefinitionException("XML defined specializing EJB must have annotation defined EJB implementation");
}
@@ -141,9 +140,9 @@
// <1 (0) @Destructors
- if (getEjbMetaData().getNoArgsRemoveMethod() != null)
+ if (getEjbMetaData().getNoArgsRemoveMethods().size() == 1)
{
- super.removeMethod = checkRemoveMethod(getEjbMetaData().getNoArgsRemoveMethod());
+ super.removeMethod = getEjbMetaData().getNoArgsRemoveMethods().get(0);
return;
}
@@ -154,24 +153,31 @@
}
- private InjectableMethod<?> checkRemoveMethod(Method method)
+ private void checkRemoveMethod()
{
- if (method.isAnnotationPresent(Destructor.class) && !method.isAnnotationPresent(EJB.REMOVE_ANNOTATION)) {
- throw new DefinitionException("Methods marked @Destructor must also be marked @Remove on " + method.getName());
+ if (removeMethod != null)
+ {
+ if (removeMethod.isAnnotationPresent(Destructor.class) && !removeMethod.isAnnotationPresent(EJB.REMOVE_ANNOTATION))
+ {
+ throw new DefinitionException("Methods marked @Destructor must also be marked @Remove on " + removeMethod.getName());
+ }
+ else if (removeMethod.isAnnotationPresent(Initializer.class))
+ {
+ throw new DefinitionException("Remove methods cannot be initializers on " + removeMethod.getName());
+ }
+ else if (removeMethod.isAnnotationPresent(Produces.class))
+ {
+ throw new DefinitionException("Remove methods cannot be producers on " + removeMethod.getName());
+ }
+ else if (removeMethod.getAnnotatedParameters(Disposes.class).size() > 0)
+ {
+ throw new DefinitionException("Remove method can't have @Disposes annotated parameters on " + removeMethod.getName());
+ }
+ else if (removeMethod.getAnnotatedParameters(Observes.class).size() > 0)
+ {
+ throw new DefinitionException("Remove method can't have @Observes annotated parameters on " + removeMethod.getName());
+ }
}
- if (method.isAnnotationPresent(Initializer.class)) {
- throw new DefinitionException("Remove methods cannot be initializers on " + method.getName());
- }
- if (method.isAnnotationPresent(Produces.class)) {
- throw new DefinitionException("Remove methods cannot be producers on " + method.getName());
- }
- if (hasParameterAnnotation(method.getParameterAnnotations(), Disposes.class)) {
- throw new DefinitionException("Remove method can't have @Disposes annotated parameters on " + method.getName());
- }
- if (hasParameterAnnotation(method.getParameterAnnotations(), Observes.class)) {
- throw new DefinitionException("Remove method can't have @Observes annotated parameters on " + method.getName());
- }
- return new InjectableMethod<Object>(method);
}
@Override
@@ -194,7 +200,7 @@
protected void callInitializers(T instance)
{
- for (InjectableMethod<Object> initializer : getInitializerMethods())
+ for (AnnotatedMethod<Object> initializer : getInitializerMethods())
{
initializer.invoke(getManager(), instance);
}
@@ -207,9 +213,9 @@
protected void injectBoundFields(T instance)
{
- for (InjectableField<?> injectableField : getInjectableFields())
+ for (AnnotatedField<?> field : getInjectableFields())
{
- injectableField.inject(instance, getManager());
+ field.inject(instance, getManager());
}
}
@@ -221,19 +227,6 @@
}
return location;
}
-
- //FIXME move up?
- private boolean hasParameterAnnotation(Annotation[][] parameterAnnotations, Class<? extends Annotation> clazz)
- {
- for (Annotation[] parameter : parameterAnnotations) {
- for (Annotation annotation : parameter) {
- if (annotation.annotationType() == clazz) {
- return true;
- }
- }
- }
- return false;
- }
@Override
protected AbstractBean<? extends T, Class<T>> getSpecializedType()
@@ -250,13 +243,6 @@
}
- private boolean isEJB(Class<? super T> clazz)
- {
- return clazz.isAnnotationPresent(EJB.SINGLETON_ANNOTATION)
- || clazz.isAnnotationPresent(EJB.STATEFUL_ANNOTATION)
- || clazz.isAnnotationPresent(EJB.STATELESS_ANNOTATION);
- }
-
private void checkEnterpriseBeanTypeAllowed()
{
if (getEjbMetaData().isMessageDriven())
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EventBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EventBean.java 2008-11-12 21:09:31 UTC (rev 296)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EventBean.java 2008-11-13 09:42:14 UTC (rev 297)
@@ -21,10 +21,10 @@
private String location;
private AnnotatedField<EventImpl<T>> annotatedItem;
- public EventBean(Field field, ManagerImpl manager)
+ public EventBean(Field field, ManagerImpl manager, AbstractClassBean<?> declaringBean)
{
super(manager);
- this.annotatedItem = new SimpleAnnotatedField<EventImpl<T>>(field);
+ this.annotatedItem = new SimpleAnnotatedField<EventImpl<T>>(field, declaringBean.getAnnotatedItem());
init();
}
Copied: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ForwardingBean.java (from rev 296, ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/BeanWrapper.java)
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ForwardingBean.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ForwardingBean.java 2008-11-13 09:42:14 UTC (rev 297)
@@ -0,0 +1,91 @@
+package org.jboss.webbeans.bean;
+
+import java.lang.annotation.Annotation;
+import java.util.Set;
+
+import javax.webbeans.manager.Bean;
+import javax.webbeans.manager.Manager;
+
+public abstract class ForwardingBean<T> extends Bean<T>
+{
+
+ public ForwardingBean(Manager manager)
+ {
+ super(manager);
+ }
+
+ @Override
+ public T create()
+ {
+ return delegate().create();
+ }
+
+ @Override
+ public void destroy(T instance)
+ {
+ delegate().destroy(instance);
+ }
+
+ @Override
+ public Set<Annotation> getBindingTypes()
+ {
+ return delegate().getBindingTypes();
+ }
+
+ @Override
+ public Class<? extends Annotation> getDeploymentType()
+ {
+ return delegate().getDeploymentType();
+ }
+
+ @Override
+ public String getName()
+ {
+ return delegate().getName();
+ }
+
+ @Override
+ public Class<? extends Annotation> getScopeType()
+ {
+ return delegate().getScopeType();
+ }
+
+ @Override
+ public Set<Class<?>> getTypes()
+ {
+ return delegate().getTypes();
+ }
+
+ @Override
+ public boolean isNullable()
+ {
+ return delegate().isNullable();
+ }
+
+ @Override
+ public boolean isSerializable()
+ {
+ return delegate().isSerializable();
+ }
+
+ @Override
+ public String toString()
+ {
+ return delegate().toString();
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return delegate().hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ return delegate().equals(obj);
+ }
+
+ protected abstract Bean<T> delegate();
+
+}
Property changes on: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ForwardingBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java 2008-11-12 21:09:31 UTC (rev 296)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java 2008-11-13 09:42:14 UTC (rev 297)
@@ -16,14 +16,12 @@
import org.jboss.webbeans.ManagerImpl;
import org.jboss.webbeans.introspector.AnnotatedMethod;
import org.jboss.webbeans.introspector.AnnotatedParameter;
-import org.jboss.webbeans.introspector.impl.InjectableMethod;
-import org.jboss.webbeans.introspector.impl.InjectableParameter;
import org.jboss.webbeans.introspector.impl.SimpleAnnotatedMethod;
public class ProducerMethodBean<T> extends AbstractBean<T, Method>
{
- private AnnotatedMethod<T> annotatedMethod;
+ private AnnotatedMethod<T> method;
private AbstractClassBean<?> declaringBean;
// Cached values
@@ -32,7 +30,7 @@
public ProducerMethodBean(Method method, AbstractClassBean<?> declaringBean, ManagerImpl manager)
{
super(manager);
- this.annotatedMethod = new SimpleAnnotatedMethod<T>(method);
+ this.method = new SimpleAnnotatedMethod<T>(method, declaringBean.getAnnotatedItem());
this.declaringBean = declaringBean;
init();
}
@@ -40,7 +38,7 @@
@Override
public T create()
{
- T instance = annotatedMethod.invoke(getManager(), getManager().getInstance(getDeclaringBean()));
+ T instance = method.invoke(getManager(), getManager().getInstance(getDeclaringBean()));
if (instance == null && !getScopeType().equals(Dependent.class))
{
throw new IllegalProductException("Cannot return null from a non-dependent method");
@@ -61,13 +59,13 @@
protected void initInjectionPoints()
{
super.initInjectionPoints();
- for (AnnotatedParameter<Object> annotatedParameter : annotatedMethod.getParameters())
+ for (AnnotatedParameter<Object> parameter : method.getParameters())
{
- injectionPoints.add(new InjectableParameter<Object>(annotatedParameter));
+ injectionPoints.add(parameter);
}
if (removeMethod != null)
{
- for (InjectableParameter<?> injectable : removeMethod.getParameters())
+ for (AnnotatedParameter<?> injectable : removeMethod.getParameters())
{
injectionPoints.add(injectable);
}
@@ -88,7 +86,7 @@
{
if (getAnnotatedItem().isStatic())
{
- throw new DefinitionException("Producer method cannot be static " + annotatedMethod);
+ throw new DefinitionException("Producer method cannot be static " + method);
}
else if (getAnnotatedItem().isAnnotationPresent(Destructor.class))
{
@@ -116,10 +114,10 @@
protected void initRemoveMethod()
{
- Set<Method> disposalMethods = getManager().resolveDisposalMethods(getType(), getBindingTypes().toArray(new Annotation[0]));
+ Set<AnnotatedMethod<Object>> disposalMethods = getManager().resolveDisposalMethods(getType(), getBindingTypes().toArray(new Annotation[0]));
if (disposalMethods.size() == 1)
{
- removeMethod = new InjectableMethod<Object>(disposalMethods.iterator().next());
+ removeMethod = disposalMethods.iterator().next();
}
else if (disposalMethods.size() > 1)
{
@@ -137,13 +135,13 @@
@Override
protected AnnotatedMethod<T> getAnnotatedItem()
{
- return annotatedMethod;
+ return method;
}
@Override
protected String getDefaultName()
{
- return annotatedMethod.getPropertyName();
+ return method.getPropertyName();
}
@Override
@@ -158,7 +156,7 @@
}
catch (ClassCastException e)
{
- throw new RuntimeException(getLocation() + " Cannot cast producer method return type " + annotatedMethod.getAnnotatedMethod().getReturnType() + " to bean type " + (getDeclaredBeanType() == null ? " unknown " : getDeclaredBeanType()), e);
+ throw new RuntimeException(getLocation() + " Cannot cast producer method return type " + method.getType() + " to bean type " + (getDeclaredBeanType() == null ? " unknown " : getDeclaredBeanType()), e);
}
}
@@ -188,12 +186,12 @@
{
if (location == null)
{
- location = "type: Producer Method; declaring class: " + annotatedMethod.getAnnotatedMethod().getDeclaringClass() +"; producer method: " + annotatedMethod.getAnnotatedMethod().toString() + ";";
+ location = "type: Producer Method; declaring class: " + method.getDeclaringClass() +"; producer method: " + method.toString() + ";";
}
return location;
}
- public InjectableMethod<?> getDisposalMethod()
+ public AnnotatedMethod<?> getDisposalMethod()
{
return removeMethod;
}
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 2008-11-12 21:09:31 UTC (rev 296)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/SimpleBean.java 2008-11-13 09:42:14 UTC (rev 297)
@@ -1,6 +1,7 @@
package org.jboss.webbeans.bean;
import java.util.Collections;
+import java.util.List;
import java.util.Set;
import javax.annotation.PostConstruct;
@@ -10,11 +11,9 @@
import org.jboss.webbeans.ManagerImpl;
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.impl.InjectableField;
-import org.jboss.webbeans.introspector.impl.InjectableMethod;
-import org.jboss.webbeans.introspector.impl.InjectableParameter;
import org.jboss.webbeans.log.LogProvider;
import org.jboss.webbeans.log.Logging;
import org.jboss.webbeans.util.Reflections;
@@ -23,7 +22,7 @@
{
private static LogProvider log = Logging.getLogProvider(SimpleBean.class);
- private static Set<Class<?>> NO_ARGUMENTS = Collections.emptySet();
+ private static List<Class<?>> NO_ARGUMENTS = Collections.emptyList();
private AnnotatedConstructor<T> constructor;
private String location;
@@ -63,7 +62,7 @@
{
try
{
- preDestroy.getAnnotatedMethod().invoke(instance);
+ preDestroy.invoke(instance);
}
catch (Exception e)
{
@@ -90,7 +89,7 @@
protected void callInitializers(T instance)
{
- for (InjectableMethod<Object> initializer : getInitializerMethods())
+ for (AnnotatedMethod<Object> initializer : getInitializerMethods())
{
initializer.invoke(getManager(), instance);
}
@@ -103,7 +102,7 @@
protected void injectBoundFields(T instance)
{
- for (InjectableField<?> injectableField : getInjectableFields())
+ for (AnnotatedField<?> injectableField : getInjectableFields())
{
injectableField.inject(instance, getManager());
}
@@ -127,7 +126,7 @@
super.initInjectionPoints();
for (AnnotatedParameter<Object> parameter : constructor.getParameters())
{
- injectionPoints.add(new InjectableParameter<Object>(parameter));
+ injectionPoints.add(parameter);
}
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ejb/DefaultEnterpriseBeanLookup.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ejb/DefaultEnterpriseBeanLookup.java 2008-11-12 21:09:31 UTC (rev 296)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ejb/DefaultEnterpriseBeanLookup.java 2008-11-13 09:42:14 UTC (rev 297)
@@ -36,7 +36,7 @@
}
//TODO: this method needs to get called at startup
- public <T> EjbMetaData<T> registerEjbMetaData(Class<? extends T> clazz)
+ public <T> EjbMetaData<T> registerEjbMetaData(Class<T> clazz)
{
EjbMetaData<T> ejbMetaData = new EjbMetaData<T>(clazz);
ejbMetaDataMap.put(ejbMetaData.getEjbName(), ejbMetaData);
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ejb/EjbMetaData.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ejb/EjbMetaData.java 2008-11-12 21:09:31 UTC (rev 296)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ejb/EjbMetaData.java 2008-11-13 09:42:14 UTC (rev 297)
@@ -10,14 +10,15 @@
import static org.jboss.webbeans.ejb.EjbMetaData.EjbType.STATEFUL;
import static org.jboss.webbeans.ejb.EjbMetaData.EjbType.STATELESS;
-import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import javax.webbeans.DefinitionException;
import javax.webbeans.Destructor;
-import org.jboss.webbeans.util.Reflections;
+import org.jboss.webbeans.introspector.AnnotatedClass;
+import org.jboss.webbeans.introspector.AnnotatedMethod;
+import org.jboss.webbeans.introspector.impl.SimpleAnnotatedClass;
public class EjbMetaData<T>
{
@@ -31,9 +32,9 @@
}
private EjbType ejbType;
- private List<Method> removeMethods = new ArrayList<Method>();
- private List<Method> destructorMethods = new ArrayList<Method>();
- private List<Method> noArgsRemoveMethods = new ArrayList<Method>();
+ private List<AnnotatedMethod<Object>> removeMethods = new ArrayList<AnnotatedMethod<Object>>();
+ private List<AnnotatedMethod<Object>> destructorMethods = new ArrayList<AnnotatedMethod<Object>>();
+ private List<AnnotatedMethod<Object>> noArgsRemoveMethods = new ArrayList<AnnotatedMethod<Object>>();
// TODO Populate this from web.xml
private String ejbLinkJndiName;
@@ -44,32 +45,38 @@
// TODO Initialize the ejb name
private String ejbName;
- private Class<? extends T> type;
+ private AnnotatedClass<T> type;
- public EjbMetaData(Class<? extends T> type)
+ public EjbMetaData(Class<T> type)
{
+ this(new SimpleAnnotatedClass<T>(type));
+ }
+
+ public EjbMetaData(AnnotatedClass<T> type)
+ {
// TODO Merge in ejb-jar.xml
this.type = type;
if (type.isAnnotationPresent(STATELESS_ANNOTATION))
{
this.ejbType = STATELESS;
// TODO Has to be done here? If they are not parsed, they can't be detected later on (EnterpriseBean remove method init)
- if (!Reflections.getMethods(type, Destructor.class).isEmpty()) {
+ if (type.getAnnotatedMethods(Destructor.class).size() > 0)
+ {
throw new DefinitionException("Stateless enterprise beans cannot have @Destructor methods");
}
}
else if (type.isAnnotationPresent(STATEFUL_ANNOTATION))
{
this.ejbType = STATEFUL;
- for (Method removeMethod : Reflections.getMethods(type, REMOVE_ANNOTATION))
+ for (AnnotatedMethod<Object> removeMethod : type.getAnnotatedMethods(REMOVE_ANNOTATION))
{
removeMethods.add(removeMethod);
- if (removeMethod.getParameterTypes().length == 0) {
+ if (removeMethod.getParameters().size() == 0) {
noArgsRemoveMethods.add(removeMethod);
}
}
- for (Method destructorMethod : Reflections.getMethods(type, Destructor.class))
+ for (AnnotatedMethod<Object> destructorMethod : type.getAnnotatedMethods(Destructor.class))
{
destructorMethods.add(destructorMethod);
}
@@ -104,8 +111,13 @@
return SINGLETON.equals(ejbType);
}
- public List<Method> getRemoveMethods()
+ public boolean isEjb()
{
+ return ejbType != null;
+ }
+
+ public List<AnnotatedMethod<Object>> getRemoveMethods()
+ {
return removeMethods;
}
@@ -124,19 +136,19 @@
return ejbName;
}
- public Class<? extends T> getType()
+ public Class<T> getType()
{
- return type;
+ return type.getType();
}
- public List<Method> getDestructorMethods()
+ public List<AnnotatedMethod<Object>> getDestructorMethods()
{
return destructorMethods;
}
- public Method getNoArgsRemoveMethod()
+ public List<AnnotatedMethod<Object>> getNoArgsRemoveMethods()
{
- return noArgsRemoveMethods.size() == 1 ? noArgsRemoveMethods.iterator().next() : null;
+ return noArgsRemoveMethods;
}
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/ObserverImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/ObserverImpl.java 2008-11-12 21:09:31 UTC (rev 296)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/ObserverImpl.java 2008-11-13 09:42:14 UTC (rev 297)
@@ -1,22 +1,14 @@
package org.jboss.webbeans.event;
import java.lang.annotation.Annotation;
-import java.util.Iterator;
-import java.util.List;
import javax.webbeans.Current;
import javax.webbeans.Observer;
import org.jboss.webbeans.ManagerImpl;
import org.jboss.webbeans.bean.EventBean;
-import org.jboss.webbeans.introspector.impl.ForwardingInjectableMethod;
-import org.jboss.webbeans.introspector.impl.ForwardingInjectableParameter;
-import org.jboss.webbeans.introspector.impl.InjectableMethod;
-import org.jboss.webbeans.introspector.impl.InjectableParameter;
+import org.jboss.webbeans.introspector.AnnotatedMethod;
-import com.google.common.collect.ForwardingIterator;
-import com.google.common.collect.ForwardingList;
-
/**
* <p>
* Reference implementation for the Observer interface, which represents an
@@ -32,7 +24,7 @@
{
private EventBean<T> eventBean;
- private final InjectableMethod<Object> observerMethod;
+ private final AnnotatedMethod<Object> observerMethod;
private final Class<T> eventType;
/**
@@ -59,7 +51,7 @@
* @param eventType The type of event being observed
*/
public ObserverImpl(final EventBean<T> eventBean,
- final InjectableMethod<Object> observer, final Class<T> eventType)
+ final AnnotatedMethod<Object> observer, final Class<T> eventType)
{
this.eventBean = eventBean;
this.observerMethod = observer;
@@ -88,77 +80,8 @@
Object instance = getInstance();
if (instance != null)
{
- new ForwardingInjectableMethod<Object>()
- {
-
- @Override
- public List<InjectableParameter<Object>> getParameters()
- {
- final List<InjectableParameter<Object>>parameters = super.getParameters();
-
- return new ForwardingList<InjectableParameter<Object>>()
- {
-
- @Override
- public Iterator<InjectableParameter<Object>> iterator()
- {
- final Iterator<InjectableParameter<Object>> iterator = super.iterator();
- return new ForwardingIterator<InjectableParameter<Object>>()
- {
-
- @Override
- public InjectableParameter<Object> next()
- {
- final InjectableParameter<Object> parameter = super.next();
- if (parameter.getType().isAssignableFrom(event.getClass()))
- {
- return new ForwardingInjectableParameter<Object>()
- {
- @Override
- public Object getValue(ManagerImpl manager)
- {
- return event;
- }
-
- @Override
- protected InjectableParameter<? extends Object> delegate()
- {
- return parameter;
- }
- };
- }
- else
- {
- return parameter;
- }
- }
-
- @Override
- protected Iterator<InjectableParameter<Object>> delegate()
- {
- return iterator;
- }
-
- };
- }
-
- @Override
- protected List<InjectableParameter<Object>> delegate()
- {
- return parameters;
- }
-
- };
- }
-
-
- @Override
- protected InjectableMethod<Object> delegate()
- {
- return observerMethod;
- }
-
- }.invoke(manager, instance);
+ // TODO replace event parameter
+ observerMethod.invoke(manager, instance);
}
}
Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/exceptions/TypesafeResolutionLocation.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/exceptions/TypesafeResolutionLocation.java 2008-11-12 21:09:31 UTC (rev 296)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/exceptions/TypesafeResolutionLocation.java 2008-11-13 09:42:14 UTC (rev 297)
@@ -1,66 +0,0 @@
-package org.jboss.webbeans.exceptions;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-import java.util.Set;
-
-import org.jboss.webbeans.introspector.impl.Injectable;
-
-public class TypesafeResolutionLocation extends Location
-{
-
- private String target;
-
- private TypesafeResolutionLocation()
- {
- super("Typesafe resolution", null, null);
- }
-
- public TypesafeResolutionLocation(Injectable<?, ?> injectable)
- {
- this();
- this.target = injectable.getAnnotatedItem().toString();
- }
-
- public String getTarget()
- {
- return target;
- }
-
- public void setTarget(String target)
- {
- this.target = target;
- }
-
- @Override
- protected String getMessage()
- {
- String location = super.getMessage();
- if (getTarget() != null)
- {
- location += "target: " + getTarget() + "; ";
- }
- return location;
- }
-
- public static String createMessage(Class<?> type, Type[] actualTypeArguments, Set<Annotation> annotations)
- {
- String string = type.toString();
- if (actualTypeArguments.length > 0)
- {
- string += "<";
- for (int i = 0; i < actualTypeArguments.length; i++)
- {
- string += actualTypeArguments[i].toString();
- if (i < actualTypeArguments.length - 1)
- {
- string += ",";
- }
- }
- string += ">";
- }
- string += annotations;
- return string;
- }
-
-}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedAnnotation.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedAnnotation.java 2008-11-12 21:09:31 UTC (rev 296)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedAnnotation.java 2008-11-13 09:42:14 UTC (rev 297)
@@ -3,18 +3,22 @@
import java.lang.annotation.Annotation;
import java.util.Set;
+/**
+ * Represents a meta annotation
+ *
+ * @author Pete Muir
+ *
+ */
public interface AnnotatedAnnotation<T extends Annotation> extends AnnotatedType<T>
{
/**
- * Get all annotation members
- * @return
+ * Get all members
*/
public Set<AnnotatedMethod<?>> getMembers();
/**
- * Get all annotation members
- * @return
+ * Get all the members annotated with annotationType
*/
public Set<AnnotatedMethod<?>> getAnnotatedMembers(Class<? extends Annotation> annotationType);
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedClass.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedClass.java 2008-11-12 21:09:31 UTC (rev 296)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedClass.java 2008-11-13 09:42:14 UTC (rev 297)
@@ -1,12 +1,12 @@
package org.jboss.webbeans.introspector;
import java.lang.annotation.Annotation;
+import java.util.List;
import java.util.Set;
/**
- * AnnotatedType provides a uniform access to the annotations on an annotated
- * class defined either in Java or XML
+ * Represents a Class
*
* @author Pete Muir
*
@@ -15,12 +15,6 @@
{
/**
- * Return the class of the annotated item. If this annotatedItem isn't in use
- * then this method should return null
- */
- public Class<? extends T> getAnnotatedClass();
-
- /**
* Get all fields on the type
* @return
*/
@@ -36,8 +30,7 @@
public Set<AnnotatedField<Object>> getAnnotatedFields(Class<? extends Annotation> annotationType);
/**
- * Get all fields which are annotated with the given meta annotation
- * type
+ * Get all fields which are meta-annotated with metaAnnotationType
*
* If no annotations are present which are annotated with the given meta
* annotation an empty set is returned
@@ -46,19 +39,26 @@
Class<? extends Annotation> metaAnnotationType);
/**
- * Get all fields which are annotated with the given meta annotation
- * type
- *
- * If no annotations are present which are annotated with the given meta
- * annotation an empty set is returned
+ * Get all constructors which are annotated with annotationType
*/
- public Set<AnnotatedMethod<Object>> getAnnotatedMethods(
- Class<? extends Annotation> annotationType);
-
public Set<AnnotatedConstructor<T>> getAnnotatedConstructors(Class<? extends Annotation> annotationType);
+ /**
+ * Get all constructors
+ *
+ */
public Set<AnnotatedConstructor<T>> getConstructors();
- public AnnotatedConstructor<T> getConstructor(Set<Class<?>> arguments);
+ /**
+ * Get the constructor with arguments given
+ */
+ public AnnotatedConstructor<T> getConstructor(List<Class<?>> arguments);
+ /**
+ * Get all the members annotated with annotationType
+ */
+ public Set<AnnotatedMethod<Object>> getAnnotatedMethods(Class<? extends Annotation> annotationType);
+
+ public AnnotatedClass<Object> getSuperclass();
+
}
\ No newline at end of file
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedConstructor.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedConstructor.java 2008-11-12 21:09:31 UTC (rev 296)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedConstructor.java 2008-11-13 09:42:14 UTC (rev 297)
@@ -7,8 +7,7 @@
import org.jboss.webbeans.ManagerImpl;
/**
- * AnnotatedType provides a uniform access to the annotations on an annotated
- * class defined either in Java or XML
+ * Represents a Class Constructor
*
* @author Pete Muir
*
@@ -16,12 +15,24 @@
public interface AnnotatedConstructor<T> extends AnnotatedItem<T, Constructor<T>>
{
+ /**
+ * Get all parameters to the constructor
+ */
public List<AnnotatedParameter<Object>> getParameters();
- public List<AnnotatedParameter<Object>> getAnnotatedParameters(Class<? extends Annotation> metaAnnotationType);
+ /**
+ * Get all parameters to the constructor which are annotated with annotationType
+ */
+ public List<AnnotatedParameter<Object>> getAnnotatedParameters(Class<? extends Annotation> annotationType);
+ /**
+ * Create a new instance of the class, using this constructor
+ */
public T newInstance(ManagerImpl manager);
- public Class<?> getDeclaringClass();
+ /**
+ *
+ */
+ public AnnotatedType<T> getDeclaringClass();
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedField.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedField.java 2008-11-12 21:09:31 UTC (rev 296)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedField.java 2008-11-13 09:42:14 UTC (rev 297)
@@ -18,7 +18,7 @@
public void inject(Object instance, ManagerImpl manager);
- public Class<?> getDeclaringClass();
+ public AnnotatedType<?> getDeclaringClass();
public String getPropertyName();
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedItem.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedItem.java 2008-11-12 21:09:31 UTC (rev 296)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedItem.java 2008-11-13 09:42:14 UTC (rev 297)
@@ -34,6 +34,13 @@
public Annotation[] getAnnotationsAsArray(
Class<? extends Annotation> metaAnnotationType);
+
+ /**
+ * Get the binding types for this element
+ */
+ public Set<Annotation> getBindingTypes();
+
+ public Annotation[] getBindingTypesAsArray();
/**
* Get an annotation for the annotation type specified.
@@ -49,20 +56,62 @@
public boolean isAnnotationPresent(
Class<? extends Annotation> annotationType);
+ /**
+ * Get the underlying element
+ * @return
+ */
public S getDelegate();
+ /**
+ * The type of the element
+ * @return
+ */
public Class<T> getType();
+ /**
+ * Extends Java Class assignability such that actual type parameters are also
+ * considered
+ */
public boolean isAssignableFrom(AnnotatedItem<?, ?> that);
+ /**
+ * Returns true if any of the types provided are assignable to this, using
+ * the extended assingablity algorithm provided by AnnotatedItem.
+ *
+ * The types are assumed to contain their own actual type parameterization.
+ */
public boolean isAssignableFrom(Set<Class<?>> types);
+ /**
+ * Return the actual type arguments for any parameterized types that this
+ * AnnotatedItem represents.
+ */
public Type[] getActualTypeArguments();
+ /**
+ * Return true if this AnnotatedItem represents a static element
+ */
public boolean isStatic();
+ /**
+ * Return true if this AnnotatedItem represents a final element
+ */
public boolean isFinal();
+ /**
+ * Return true if this AnnotatedItem can be proxyed
+ * @return
+ */
+ public boolean isProxyable();
+
+ /**
+ * Return the name of this AnnotatedItem
+ *
+ * If it is not possible to determine the name of the underling element, a
+ * IllegalArgumentException is thrown
+ */
public String getName();
+
+
}
\ No newline at end of file
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedMethod.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedMethod.java 2008-11-12 21:09:31 UTC (rev 296)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedMethod.java 2008-11-13 09:42:14 UTC (rev 297)
@@ -16,8 +16,6 @@
public interface AnnotatedMethod<T> extends AnnotatedItem<T, Method>
{
- public Method getAnnotatedMethod();
-
public List<AnnotatedParameter<Object>> getParameters();
public List<AnnotatedParameter<Object>> getAnnotatedParameters(Class<? extends Annotation> metaAnnotationType);
@@ -26,7 +24,7 @@
public T invoke(Object instance, Object...parameters);
- public Class<?> getDeclaringClass();
+ public AnnotatedType<?> getDeclaringClass();
public String getPropertyName();
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedType.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedType.java 2008-11-12 21:09:31 UTC (rev 296)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedType.java 2008-11-13 09:42:14 UTC (rev 297)
@@ -2,5 +2,7 @@
public interface AnnotatedType<T> extends AnnotatedItem<T, Class<T>>
{
+
+ public AnnotatedType<Object> getSuperclass();
}
Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/ForwardingAnnotatedItem.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/ForwardingAnnotatedItem.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/ForwardingAnnotatedItem.java 2008-11-13 09:42:14 UTC (rev 297)
@@ -0,0 +1,110 @@
+package org.jboss.webbeans.introspector;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Set;
+
+public abstract class ForwardingAnnotatedItem<T, S> implements AnnotatedItem<T, S>
+{
+
+ public Type[] getActualTypeArguments()
+ {
+ return delegate().getActualTypeArguments();
+ }
+
+ public <A extends Annotation> A getAnnotation(Class<? extends A> annotationType)
+ {
+ return delegate().getAnnotation(annotationType);
+ }
+
+ public <A extends Annotation> Set<A> getAnnotations()
+ {
+ return delegate().getAnnotations();
+ }
+
+ public Set<Annotation> getAnnotations(Class<? extends Annotation> metaAnnotationType)
+ {
+ return delegate().getAnnotations(metaAnnotationType);
+ }
+
+ public Annotation[] getAnnotationsAsArray(Class<? extends Annotation> metaAnnotationType)
+ {
+ return delegate().getAnnotationsAsArray(metaAnnotationType);
+ }
+
+ public Set<Annotation> getBindingTypes()
+ {
+ return delegate().getBindingTypes();
+ }
+
+ public Annotation[] getBindingTypesAsArray()
+ {
+ return delegate().getBindingTypesAsArray();
+ }
+
+ public S getDelegate()
+ {
+ return delegate().getDelegate();
+ }
+
+ public String getName()
+ {
+ return delegate().getName();
+ }
+
+ public Class<T> getType()
+ {
+ return delegate().getType();
+ }
+
+ public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
+ {
+ return delegate().isAnnotationPresent(annotationType);
+ }
+
+ public boolean isAssignableFrom(AnnotatedItem<?, ?> that)
+ {
+ return delegate().isAssignableFrom(that);
+ }
+
+ public boolean isAssignableFrom(Set<Class<?>> types)
+ {
+ return delegate().isAssignableFrom(types);
+ }
+
+ public boolean isFinal()
+ {
+ return delegate().isFinal();
+ }
+
+ public boolean isStatic()
+ {
+ return delegate().isStatic();
+ }
+
+ public boolean isProxyable()
+ {
+ return delegate().isProxyable();
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ return delegate().equals(obj);
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return delegate().hashCode();
+ }
+
+ @Override
+ public String toString()
+ {
+ return delegate().toString();
+ }
+
+ public abstract AnnotatedItem<T, S> delegate();
+
+}
Property changes on: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/ForwardingAnnotatedItem.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/AbstractAnnotatedItem.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/AbstractAnnotatedItem.java 2008-11-12 21:09:31 UTC (rev 296)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/AbstractAnnotatedItem.java 2008-11-13 09:42:14 UTC (rev 297)
@@ -12,8 +12,11 @@
import java.util.Set;
import java.util.Map.Entry;
+import javax.webbeans.BindingType;
+
import org.jboss.webbeans.ManagerImpl;
-import org.jboss.webbeans.exceptions.TypesafeResolutionLocation;
+import org.jboss.webbeans.bean.proxy.ClientProxy;
+import org.jboss.webbeans.bindings.CurrentAnnotationLiteral;
import org.jboss.webbeans.introspector.AnnotatedItem;
import org.jboss.webbeans.introspector.AnnotatedParameter;
import org.jboss.webbeans.util.Reflections;
@@ -22,6 +25,9 @@
public abstract class AbstractAnnotatedItem<T, S> implements AnnotatedItem<T, S>
{
+ private static final Annotation[] DEFAULT_BINDING_ARRAY = {new CurrentAnnotationLiteral()};
+ private static final Set<Annotation> DEFAULT_BINDING = new HashSet<Annotation>(Arrays.asList(DEFAULT_BINDING_ARRAY));
+
private Map<Class<? extends Annotation>, Annotation> annotationMap;
private Map<Class<? extends Annotation>, Set<Annotation>> metaAnnotationMap;
private Set<Annotation> annotationSet;
@@ -177,7 +183,51 @@
@Override
public String toString()
{
- return TypesafeResolutionLocation.createMessage(getType(), getActualTypeArguments(), getAnnotations());
+ String string = getType().toString();
+ if (getActualTypeArguments().length > 0)
+ {
+ string += "<";
+ for (int i = 0; i < getActualTypeArguments().length; i++)
+ {
+ string += getActualTypeArguments()[i].toString();
+ if (i < getActualTypeArguments().length - 1)
+ {
+ string += ",";
+ }
+ }
+ string += ">";
+ }
+ string += getAnnotations();
+ return string;
}
+
+ public Set<Annotation> getBindingTypes()
+ {
+ if (getAnnotations(BindingType.class).size() > 0)
+ {
+ return getAnnotations(BindingType.class);
+ }
+ else
+ {
+ return DEFAULT_BINDING;
+ }
+ }
+
+ public Annotation[] getBindingTypesAsArray()
+ {
+ if (getAnnotationsAsArray(BindingType.class).length > 0)
+ {
+ return getAnnotationsAsArray(BindingType.class);
+ }
+ else
+ {
+ return DEFAULT_BINDING_ARRAY;
+ }
+ }
+
+ public boolean isProxyable()
+ {
+ return ClientProxy.isProxyable(getType());
+ }
}
\ No newline at end of file
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/AbstractAnnotatedMember.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/AbstractAnnotatedMember.java 2008-11-12 21:09:31 UTC (rev 296)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/AbstractAnnotatedMember.java 2008-11-13 09:42:14 UTC (rev 297)
@@ -43,9 +43,4 @@
return name;
}
- public Class<?> getDeclaringClass()
- {
- return getDelegate().getDeclaringClass();
- }
-
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/AbstractAnnotatedType.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/AbstractAnnotatedType.java 2008-11-12 21:09:31 UTC (rev 296)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/AbstractAnnotatedType.java 2008-11-13 09:42:14 UTC (rev 297)
@@ -3,10 +3,13 @@
import java.lang.annotation.Annotation;
import java.util.Map;
+import org.jboss.webbeans.introspector.AnnotatedClass;
import org.jboss.webbeans.util.Reflections;
public abstract class AbstractAnnotatedType<T> extends AbstractAnnotatedItem<T, Class<T>>
{
+
+ private AnnotatedClass<Object> superclass;
public AbstractAnnotatedType(Map<Class<? extends Annotation>, Annotation> annotationMap)
{
@@ -28,4 +31,15 @@
return getDelegate().getName();
}
+ @SuppressWarnings("unchecked")
+ // TODO Fix this
+ public AnnotatedClass<Object> getSuperclass()
+ {
+ if (superclass == null)
+ {
+ superclass = new SimpleAnnotatedClass(getDelegate().getSuperclass());
+ }
+ return superclass;
+ }
+
}
Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/ForwardingInjectableMethod.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/ForwardingInjectableMethod.java 2008-11-12 21:09:31 UTC (rev 296)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/ForwardingInjectableMethod.java 2008-11-13 09:42:14 UTC (rev 297)
@@ -1,63 +0,0 @@
-package org.jboss.webbeans.introspector.impl;
-
-import java.util.List;
-
-import javax.webbeans.manager.Manager;
-
-import org.jboss.webbeans.ManagerImpl;
-import org.jboss.webbeans.introspector.AnnotatedMethod;
-
-public abstract class ForwardingInjectableMethod<T> extends InjectableMethod<T>
-{
-
- @Override
- public boolean equals(Object obj)
- {
- return delegate().equals(obj);
- }
-
- @Override
- public AnnotatedMethod<T> getAnnotatedItem()
- {
- return delegate().getAnnotatedItem();
- }
-
- @Override
- public List<InjectableParameter<Object>> getParameters()
- {
- return delegate().getParameters();
- }
-
- @Override
- protected Object[] getParameterValues(ManagerImpl manager)
- {
- return delegate().getParameterValues(manager);
- }
-
- @Override
- public int hashCode()
- {
- return delegate().hashCode();
- }
-
- @Override
- public T invoke(Manager manager, Object instance, Object[] parameters)
- {
- return delegate().invoke(manager, instance, parameters);
- }
-
- @Override
- public T invoke(ManagerImpl manager, Object instance)
- {
- return delegate().invoke(manager, instance);
- }
-
- @Override
- public String toString()
- {
- return delegate().toString();
- }
-
- protected abstract InjectableMethod<T> delegate();
-
-}
Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/ForwardingInjectableParameter.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/ForwardingInjectableParameter.java 2008-11-12 21:09:31 UTC (rev 296)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/ForwardingInjectableParameter.java 2008-11-13 09:42:14 UTC (rev 297)
@@ -1,41 +0,0 @@
-package org.jboss.webbeans.introspector.impl;
-
-import java.lang.annotation.Annotation;
-import java.util.List;
-import java.util.Set;
-
-import javax.webbeans.manager.Bean;
-
-import org.jboss.webbeans.ManagerImpl;
-import org.jboss.webbeans.ModelManager;
-
-public abstract class ForwardingInjectableParameter<T> extends InjectableParameter<T>
-{
-
- protected abstract InjectableParameter<? extends T> delegate();
-
- @Override
- public Set<Annotation> getBindingTypes()
- {
- return delegate().getBindingTypes();
- }
-
- @Override
- public Set<Bean<?>> getMatchingBeans(List<Bean<?>> possibleBeans, ModelManager modelManager)
- {
- return delegate().getMatchingBeans(possibleBeans, modelManager);
- }
-
- @Override
- public Class<? extends T> getType()
- {
- return delegate().getType();
- }
-
- @Override
- public T getValue(ManagerImpl manager)
- {
- return delegate().getValue(manager);
- }
-
-}
Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/Injectable.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/Injectable.java 2008-11-12 21:09:31 UTC (rev 296)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/Injectable.java 2008-11-13 09:42:14 UTC (rev 297)
@@ -1,155 +0,0 @@
-package org.jboss.webbeans.introspector.impl;
-
-import java.lang.annotation.Annotation;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import javax.webbeans.BindingType;
-import javax.webbeans.manager.Bean;
-
-import org.jboss.webbeans.ManagerImpl;
-import org.jboss.webbeans.ModelManager;
-import org.jboss.webbeans.bindings.CurrentAnnotationLiteral;
-import org.jboss.webbeans.introspector.AnnotatedItem;
-import org.jboss.webbeans.model.BindingTypeModel;
-
-/**
- * Abstraction of java reflection for Web Beans, represent's something that can
- * be injected
- *
- * @author Pete Muir
- *
- */
-public abstract class Injectable<T, S>
-{
-
- private static final Annotation[] DEFAULT_BINDING_ARRAY = {new CurrentAnnotationLiteral()};
- private static final Set<Annotation> DEFAULT_BINDING = new HashSet<Annotation>(Arrays.asList(DEFAULT_BINDING_ARRAY));
-
- private AnnotatedItem<T, S> annotatedItem;
-
- private boolean useDefaultBinding;
-
- public Injectable(AnnotatedItem<T, S> annotatedItem)
- {
- this.annotatedItem = annotatedItem;
- if (annotatedItem.getAnnotations(BindingType.class).size() == 0)
- {
- useDefaultBinding = true;
- }
- }
-
- public Set<Annotation> getBindingTypes()
- {
- if (useDefaultBinding)
- {
- return DEFAULT_BINDING;
- }
- else
- {
- return annotatedItem.getAnnotations(BindingType.class);
- }
- }
-
- public Annotation[] getBindingTypesAsArray()
- {
- if (useDefaultBinding)
- {
- return DEFAULT_BINDING_ARRAY;
- }
- else
- {
- return annotatedItem.getAnnotationsAsArray(BindingType.class);
- }
- }
-
- protected Injectable() {}
-
- @Override
- public String toString()
- {
- return getClass().getSimpleName() + "[" + getAnnotatedItem().toString() + "]";
- }
-
- public T getValue(ManagerImpl manager)
- {
- return manager.getInstanceByType(getType(), getBindingTypesAsArray());
- }
-
- public Class<? extends T> getType()
- {
- return annotatedItem.getType();
- }
-
- public AnnotatedItem<T, S> getAnnotatedItem()
- {
- return annotatedItem;
- }
-
- public Set<Bean<?>> getMatchingBeans(List<Bean<?>> beans, ModelManager modelManager)
- {
- Set<Bean<?>> resolvedBeans = new HashSet<Bean<?>>();
- for (Bean<?> bean : beans)
- {
- if (getAnnotatedItem().isAssignableFrom(bean.getTypes()) && containsAllBindingBindingTypes(bean.getBindingTypes(), modelManager))
- {
- resolvedBeans.add(bean);
- }
- }
- return resolvedBeans;
- }
-
- @Override
- public boolean equals(Object other)
- {
- // TODO Do we need to check the other direction too?
- if (other instanceof Injectable)
- {
- Injectable<?, ?> that = (Injectable<?, ?>) other;
- return this.getAnnotatedItem().isAssignableFrom(that.getAnnotatedItem()) &&
- that.getBindingTypes().equals(this.getBindingTypes());
- }
- else
- {
- return false;
- }
- }
-
- @Override
- public int hashCode()
- {
- // TODO Implement this!
- return 0;
- }
-
- private boolean containsAllBindingBindingTypes(Set<Annotation> bindingTypes, ModelManager modelManager)
- {
- for (Annotation bindingType : getBindingTypes())
- {
- BindingTypeModel<?> bindingTypeModel = modelManager.getBindingTypeModel(bindingType.annotationType());
- if (bindingTypeModel.getNonBindingTypes().size() > 0)
- {
- boolean matchFound = false;
- for (Annotation otherBindingType : bindingTypes)
- {
- if (bindingTypeModel.isEqual(bindingType, otherBindingType))
- {
- matchFound = true;
- }
- }
- if (!matchFound)
- {
- return false;
- }
- }
- else if (!bindingTypes.contains(bindingType))
- {
- return false;
- }
- }
- return true;
- }
-
-}
Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/InjectableField.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/InjectableField.java 2008-11-12 21:09:31 UTC (rev 296)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/InjectableField.java 2008-11-13 09:42:14 UTC (rev 297)
@@ -1,33 +0,0 @@
-package org.jboss.webbeans.introspector.impl;
-
-import java.lang.reflect.Field;
-
-import org.jboss.webbeans.ManagerImpl;
-import org.jboss.webbeans.introspector.AnnotatedField;
-import org.jboss.webbeans.util.Reflections;
-
-/**
- * Abstraction of Java Reflection
- *
- * @author Pete Muir
- *
- */
-public class InjectableField<T> extends Injectable<T, Field>
-{
-
- public InjectableField(Field field)
- {
- super(new SimpleAnnotatedField<T>(field));
- }
-
- public InjectableField(AnnotatedField<T> annotatedField)
- {
- super(annotatedField);
- }
-
- public void inject(Object instance, ManagerImpl manager)
- {
- Reflections.setAndWrap(getAnnotatedItem().getDelegate(), instance, getValue(manager));
- }
-
-}
Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/InjectableMethod.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/InjectableMethod.java 2008-11-12 21:09:31 UTC (rev 296)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/InjectableMethod.java 2008-11-13 09:42:14 UTC (rev 297)
@@ -1,49 +0,0 @@
-package org.jboss.webbeans.introspector.impl;
-
-import javax.webbeans.manager.Manager;
-
-import org.jboss.webbeans.ManagerImpl;
-import org.jboss.webbeans.introspector.AnnotatedMethod;
-
-public class InjectableMethod<T> extends Invokable<T, AnnotatedMethod<T>>
-{
-
- private AnnotatedMethod<T> method;
-
- protected InjectableMethod(){}
-
- public InjectableMethod(java.lang.reflect.Method method)
- {
- this(new SimpleAnnotatedMethod<T>(method));
- }
-
- public InjectableMethod(AnnotatedMethod<T> annotatedMethod)
- {
- super(annotatedMethod.getParameters());
- this.method = annotatedMethod;
- }
-
-
- public T invoke(ManagerImpl manager, Object instance)
- {
- return invoke(manager, instance, getParameterValues(manager));
- }
-
- public T invoke(Manager container, Object instance, Object[] parameters)
- {
- try
- {
- return (T) method.getAnnotatedMethod().invoke(instance, parameters);
- }
- catch (Exception e)
- {
- throw new RuntimeException("Unable to invoke " + method + " on " + instance, e);
- }
- }
-
- public AnnotatedMethod<T> getAnnotatedItem()
- {
- return method;
- }
-
-}
Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/InjectableParameter.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/InjectableParameter.java 2008-11-12 21:09:31 UTC (rev 296)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/InjectableParameter.java 2008-11-13 09:42:14 UTC (rev 297)
@@ -1,30 +0,0 @@
-package org.jboss.webbeans.introspector.impl;
-
-import java.lang.annotation.Annotation;
-
-import org.jboss.webbeans.bindings.CurrentAnnotationLiteral;
-import org.jboss.webbeans.introspector.AnnotatedParameter;
-
-public class InjectableParameter<T> extends Injectable<T, Object>
-{
-
- private static Annotation[] currentBinding = {new CurrentAnnotationLiteral()};
-
- protected InjectableParameter() {}
-
- public InjectableParameter(Annotation[] bindingTypes, Class<T> type)
- {
- super(new SimpleAnnotatedParameter<T>(bindingTypes, type));
- }
-
- public InjectableParameter(AnnotatedParameter<T> annotatedParameter)
- {
- super(annotatedParameter);
- }
-
- public InjectableParameter(Class<T> type)
- {
- this(currentBinding, type);
- }
-
-}
Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/InjectableWrapper.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/InjectableWrapper.java 2008-11-12 21:09:31 UTC (rev 296)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/InjectableWrapper.java 2008-11-13 09:42:14 UTC (rev 297)
@@ -1,46 +0,0 @@
-package org.jboss.webbeans.introspector.impl;
-
-import java.lang.annotation.Annotation;
-import java.util.List;
-import java.util.Set;
-
-import javax.webbeans.manager.Bean;
-
-import org.jboss.webbeans.ManagerImpl;
-import org.jboss.webbeans.ModelManager;
-
-public class InjectableWrapper<T, S> extends Injectable<T, S>
-{
-
- private Injectable<T, S> delegate;
-
- public InjectableWrapper(Injectable<T, S> delegate)
- {
- this.delegate = delegate;
- }
-
- @Override
- public Set<Annotation> getBindingTypes()
- {
- return delegate.getBindingTypes();
- }
-
- @Override
- public Set<Bean<?>> getMatchingBeans(List<Bean<?>> possibleBeans, ModelManager modelManager)
- {
- return delegate.getMatchingBeans(possibleBeans, modelManager);
- }
-
- @Override
- public Class<? extends T> getType()
- {
- return delegate.getType();
- }
-
- @Override
- public T getValue(ManagerImpl manager)
- {
- return delegate.getValue(manager);
- }
-
-}
\ No newline at end of file
Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/Invokable.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/Invokable.java 2008-11-12 21:09:31 UTC (rev 296)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/Invokable.java 2008-11-13 09:42:14 UTC (rev 297)
@@ -1,50 +0,0 @@
-package org.jboss.webbeans.introspector.impl;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.webbeans.manager.Manager;
-
-import org.jboss.webbeans.ManagerImpl;
-import org.jboss.webbeans.introspector.AnnotatedParameter;
-
-public abstract class Invokable<T, S>
-{
-
- private List<InjectableParameter<Object>> parameters;
-
- protected Invokable() {}
-
- public Invokable(List<AnnotatedParameter<Object>> parameters)
- {
- this.parameters = new ArrayList<InjectableParameter<Object>>();
- for (AnnotatedParameter<Object> parameter : parameters)
- {
- this.parameters.add(new InjectableParameter<Object>(parameter));
- }
- }
-
- public abstract S getAnnotatedItem();
-
- protected Object[] getParameterValues(ManagerImpl manager)
- {
- Object[] parameterValues = new Object[parameters.size()];
- Iterator<InjectableParameter<Object>> iterator = parameters.iterator();
- for (int i = 0; i < parameterValues.length; i++)
- {
- parameterValues[i] = iterator.next().getValue(manager);
- }
- return parameterValues;
- }
-
- public List<InjectableParameter<Object>> getParameters()
- {
- return parameters;
- }
-
- public abstract T invoke(Manager container, Object instance, Object[] parameters);
-
- public abstract T invoke(ManagerImpl container, Object instance);
-
-}
Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/ResolverInjectable.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/ResolverInjectable.java 2008-11-12 21:09:31 UTC (rev 296)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/ResolverInjectable.java 2008-11-13 09:42:14 UTC (rev 297)
@@ -1,53 +0,0 @@
-package org.jboss.webbeans.introspector.impl;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-
-import javax.webbeans.BindingType;
-import javax.webbeans.DuplicateBindingTypeException;
-import javax.webbeans.TypeLiteral;
-
-import org.jboss.webbeans.ModelManager;
-
-/**
- * TODO Rename this to something which implies it only ever used for resolution
- * @author Pete Muir
- *
- */
-public class ResolverInjectable<T> extends Injectable<T, Object>
-{
-
- public ResolverInjectable(SimpleAnnotatedItem<T, Object> annotatedItem, ModelManager modelManager)
- {
- super(annotatedItem);
- for (Annotation annotation : annotatedItem.getAnnotations())
- {
- if (!modelManager.getBindingTypeModel(annotation.annotationType()).isValid())
- {
- throw new IllegalArgumentException("Not a binding type " + annotation);
- }
- }
- if (annotatedItem.getActualAnnotations().length > annotatedItem.getAnnotations(BindingType.class).size())
- {
- throw new DuplicateBindingTypeException(getAnnotatedItem().toString());
- }
-
-
- }
-
- public ResolverInjectable(Class<T> type, Annotation[] bindingTypes, ModelManager modelManager)
- {
- this(new SimpleAnnotatedItem<T, Object>(bindingTypes, type), modelManager);
- }
-
- public ResolverInjectable(Class<T> type, Annotation[] bindingTypes, ModelManager modelManager, Type ... actualTypeArguments)
- {
- this(new SimpleAnnotatedItem<T, Object>(bindingTypes, type, actualTypeArguments), modelManager);
- }
-
- public ResolverInjectable(TypeLiteral<T> apiType, Annotation[] bindingTypes, ModelManager modelManager)
- {
- this(new SimpleAnnotatedItem<T, Object>(bindingTypes, apiType), modelManager);
- }
-
-}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/SimpleAnnotatedAnnotation.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/SimpleAnnotatedAnnotation.java 2008-11-12 21:09:31 UTC (rev 296)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/SimpleAnnotatedAnnotation.java 2008-11-13 09:42:14 UTC (rev 297)
@@ -55,7 +55,7 @@
this.members = new HashSet<AnnotatedMethod<?>>();
for (Method member : clazz.getDeclaredMethods())
{
- members.add(new SimpleAnnotatedMethod<Object>(member));
+ members.add(new SimpleAnnotatedMethod<Object>(member, this));
}
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/SimpleAnnotatedClass.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/SimpleAnnotatedClass.java 2008-11-12 21:09:31 UTC (rev 296)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/SimpleAnnotatedClass.java 2008-11-13 09:42:14 UTC (rev 297)
@@ -9,6 +9,7 @@
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -18,8 +19,7 @@
import org.jboss.webbeans.introspector.AnnotatedMethod;
/**
- * Base class for implementing AnnotatedItem. This implementation assumes
- * the annotationMap is immutable.
+ * Base class for implementing AnnotatedItem.
*
* @author pmuir
*
@@ -39,16 +39,15 @@
private Set<AnnotatedConstructor<T>> constructors;
private Map<Class<? extends Annotation>, Set<AnnotatedConstructor<T>>> annotatedConstructors;
- private Map<Set<Class<?>>, AnnotatedConstructor<T>> constructorsByArgumentMap;
+ private Map<List<Class<?>>, AnnotatedConstructor<T>> constructorsByArgumentMap;
- public SimpleAnnotatedClass(Class<T> annotatedClass, Map<Class<? extends Annotation>, Annotation> annotationMap)
+ public SimpleAnnotatedClass(Class<T> rawType, Type type, Annotation[] annotations)
{
- super(annotationMap);
- this.clazz = annotatedClass;
- if (this.clazz.getGenericSuperclass() instanceof ParameterizedType)
+ super(buildAnnotationMap(annotations));
+ this.clazz = rawType;
+ if (type instanceof ParameterizedType)
{
- ParameterizedType type = (ParameterizedType) this.clazz.getGenericSuperclass();
- actualTypeArguments = type.getActualTypeArguments();
+ actualTypeArguments = ((ParameterizedType) type).getActualTypeArguments();
}
else
{
@@ -56,9 +55,9 @@
}
}
- public SimpleAnnotatedClass(Class<T> annotatedClass)
+ public SimpleAnnotatedClass(Class<T> clazz)
{
- this(annotatedClass, buildAnnotationMap(annotatedClass));
+ this(clazz, clazz, clazz.getAnnotations());
}
public Class<? extends T> getAnnotatedClass()
@@ -97,7 +96,7 @@
for(Field field : clazz.getDeclaredFields())
{
if ( !field.isAccessible() ) field.setAccessible(true);
- fields.add(new SimpleAnnotatedField<Object>(field));
+ fields.add(new SimpleAnnotatedField<Object>(field, this));
}
}
}
@@ -185,7 +184,7 @@
for (Method method : clazz.getDeclaredMethods())
{
if (!method.isAccessible()) method.setAccessible(true);
- methods.add(new SimpleAnnotatedMethod<Object>(method));
+ methods.add(new SimpleAnnotatedMethod<Object>(method, this));
}
}
}
@@ -230,13 +229,13 @@
private void initConstructors()
{
this.constructors = new HashSet<AnnotatedConstructor<T>>();
- this.constructorsByArgumentMap = new HashMap<Set<Class<?>>, AnnotatedConstructor<T>>();
+ this.constructorsByArgumentMap = new HashMap<List<Class<?>>, AnnotatedConstructor<T>>();
for (Constructor<T> constructor : clazz.getDeclaredConstructors())
{
- AnnotatedConstructor<T> annotatedConstructor = new SimpleAnnotatedConstructor<T>(constructor);
+ AnnotatedConstructor<T> annotatedConstructor = new SimpleAnnotatedConstructor<T>(constructor, this);
if (!constructor.isAccessible()) constructor.setAccessible(true);
constructors.add(annotatedConstructor);
- constructorsByArgumentMap.put(new HashSet<Class<?>>(Arrays.asList(constructor.getParameterTypes())), annotatedConstructor);
+ constructorsByArgumentMap.put(Arrays.asList(constructor.getParameterTypes()), annotatedConstructor);
}
}
@@ -277,7 +276,7 @@
}
}
- public AnnotatedConstructor<T> getConstructor(Set<Class<?>> arguments)
+ public AnnotatedConstructor<T> getConstructor(List<Class<?>> arguments)
{
return constructorsByArgumentMap.get(arguments);
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/SimpleAnnotatedConstructor.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/SimpleAnnotatedConstructor.java 2008-11-12 21:09:31 UTC (rev 296)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/SimpleAnnotatedConstructor.java 2008-11-13 09:42:14 UTC (rev 297)
@@ -14,6 +14,7 @@
import org.jboss.webbeans.ManagerImpl;
import org.jboss.webbeans.introspector.AnnotatedConstructor;
import org.jboss.webbeans.introspector.AnnotatedParameter;
+import org.jboss.webbeans.introspector.AnnotatedType;
public class SimpleAnnotatedConstructor<T> extends AbstractAnnotatedMember<T, Constructor<T>> implements AnnotatedConstructor<T>
{
@@ -25,10 +26,13 @@
private List<AnnotatedParameter<Object>> parameters;
private Map<Class<? extends Annotation>, List<AnnotatedParameter<Object>>> annotatedParameters;
- public SimpleAnnotatedConstructor(Constructor<T> constructor)
+ private AnnotatedType<T> declaringClass;
+
+ public SimpleAnnotatedConstructor(Constructor<T> constructor, AnnotatedType<T> declaringClass)
{
super(buildAnnotationMap(constructor));
this.constructor = constructor;
+ this.declaringClass = declaringClass;
}
public Constructor<T> getAnnotatedConstructor()
@@ -171,5 +175,10 @@
{
return getDelegate().hashCode();
}
+
+ public AnnotatedType<T> getDeclaringClass()
+ {
+ return declaringClass;
+ }
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/SimpleAnnotatedField.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/SimpleAnnotatedField.java 2008-11-12 21:09:31 UTC (rev 296)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/SimpleAnnotatedField.java 2008-11-13 09:42:14 UTC (rev 297)
@@ -6,6 +6,7 @@
import org.jboss.webbeans.ManagerImpl;
import org.jboss.webbeans.introspector.AnnotatedField;
+import org.jboss.webbeans.introspector.AnnotatedType;
import org.jboss.webbeans.util.Reflections;
public class SimpleAnnotatedField<T> extends AbstractAnnotatedMember<T, Field> implements AnnotatedField<T>
@@ -14,11 +15,13 @@
private Type[] actualTypeArguments = new Type[0];
private Field field;
+ private AnnotatedType<?> declaringClass;
- public SimpleAnnotatedField(Field field)
+ public SimpleAnnotatedField(Field field, AnnotatedType<?> declaringClass)
{
super(buildAnnotationMap(field));
this.field = field;
+ this.declaringClass = declaringClass;
if (field.getGenericType() instanceof ParameterizedType)
{
ParameterizedType type = (ParameterizedType) field.getGenericType();
@@ -55,5 +58,10 @@
{
return getName();
}
+
+ public AnnotatedType<?> getDeclaringClass()
+ {
+ return declaringClass;
+ }
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/SimpleAnnotatedMethod.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/SimpleAnnotatedMethod.java 2008-11-12 21:09:31 UTC (rev 296)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/SimpleAnnotatedMethod.java 2008-11-13 09:42:14 UTC (rev 297)
@@ -12,6 +12,7 @@
import org.jboss.webbeans.ManagerImpl;
import org.jboss.webbeans.introspector.AnnotatedMethod;
import org.jboss.webbeans.introspector.AnnotatedParameter;
+import org.jboss.webbeans.introspector.AnnotatedType;
import org.jboss.webbeans.util.Reflections;
public class SimpleAnnotatedMethod<T> extends AbstractAnnotatedMember<T, Method> implements AnnotatedMethod<T>
@@ -25,11 +26,14 @@
private Map<Class<? extends Annotation>, List<AnnotatedParameter<Object>>> annotatedParameters;
private String propertyName;
+
+ private AnnotatedType<?> declaringClass;
- public SimpleAnnotatedMethod(Method method)
+ public SimpleAnnotatedMethod(Method method, AnnotatedType<?> declaringClass)
{
super(buildAnnotationMap(method));
this.method = method;
+ this.declaringClass = declaringClass;
if (method.getGenericReturnType() instanceof ParameterizedType)
{
actualTypeArgements = ((ParameterizedType) method.getGenericReturnType()).getActualTypeArguments();
@@ -178,4 +182,9 @@
return propertyName;
}
+ public AnnotatedType<?> getDeclaringClass()
+ {
+ return declaringClass;
+ }
+
}
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/BindingTypeTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/BindingTypeTest.java 2008-11-12 21:09:31 UTC (rev 296)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/BindingTypeTest.java 2008-11-13 09:42:14 UTC (rev 297)
@@ -3,21 +3,14 @@
import static org.jboss.webbeans.test.util.Util.createProducerMethodBean;
import static org.jboss.webbeans.test.util.Util.createSimpleBean;
-import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
-import java.util.HashMap;
-import java.util.Map;
import javax.webbeans.Current;
import org.jboss.webbeans.bean.ProducerMethodBean;
import org.jboss.webbeans.bean.SimpleBean;
import org.jboss.webbeans.bindings.CurrentAnnotationLiteral;
-import org.jboss.webbeans.introspector.AnnotatedClass;
-import org.jboss.webbeans.introspector.impl.SimpleAnnotatedClass;
-import org.jboss.webbeans.test.annotations.Asynchronous;
import org.jboss.webbeans.test.annotations.Synchronous;
-import org.jboss.webbeans.test.beans.Antelope;
import org.jboss.webbeans.test.beans.Barn;
import org.jboss.webbeans.test.beans.Cat;
import org.jboss.webbeans.test.beans.Cod;
@@ -27,7 +20,6 @@
import org.jboss.webbeans.test.beans.SpiderProducer;
import org.jboss.webbeans.test.beans.Tarantula;
import org.jboss.webbeans.test.beans.Tuna;
-import org.jboss.webbeans.test.bindings.AsynchronousAnnotationLiteral;
import org.jboss.webbeans.util.Reflections;
import org.testng.annotations.Test;
@@ -82,9 +74,9 @@
@Test(groups={"stub", "webbeansxml"}) @SpecAssertion(section="2.3.4")
public void testBindingTypesDeclaredInXml()
{
- Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
- annotations.put(Asynchronous.class, new AsynchronousAnnotationLiteral());
- AnnotatedClass annotatedItem = new SimpleAnnotatedClass(Antelope.class, annotations);
+ //Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
+ //annotations.put(Asynchronous.class, new AsynchronousAnnotationLiteral());
+ //AnnotatedClass annotatedItem = new SimpleAnnotatedClass(Antelope.class, annotations);
//SimpleBean<Antelope> antelope = createSimpleBean(Antelope.class, annotatedItem, manager);
// assert Reflections.annotationSetMatches(antelope.getBindingTypes(), Asynchronous.class);
@@ -94,9 +86,9 @@
@Test(groups={"stub", "webbeansxml"}) @SpecAssertion(section="2.3.4")
public void testXmlBindingTypeOverridesAndIgnoresJava()
{
- Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
- annotations.put(Asynchronous.class, new AsynchronousAnnotationLiteral());
- AnnotatedClass<Cat> annotatedItem = new SimpleAnnotatedClass<Cat>(Cat.class, annotations);
+ //Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
+ //annotations.put(Asynchronous.class, new AsynchronousAnnotationLiteral());
+ //AnnotatedClass<Cat> annotatedItem = new SimpleAnnotatedClass<Cat>(Cat.class, annotations);
//SimpleBean<Cat> cat = createSimpleBean(Cat.class, annotatedItem, manager);
//assert cat.getBindingTypes().size() == 1;
@@ -107,8 +99,8 @@
@Test(groups={"stub", "webbeansxml"}) @SpecAssertion(section="2.3.4")
public void testNoBindingTypesDeclaredInXml()
{
- Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
- AnnotatedClass<Cat> annotatedItem = new SimpleAnnotatedClass<Cat>(Cat.class, annotations);
+ //Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
+ //AnnotatedClass<Cat> annotatedItem = new SimpleAnnotatedClass<Cat>(Cat.class, annotations);
//SimpleBean<Cat> cat = createSimpleBean(Cat.class, annotatedItem, manager);
//assert cat.getBindingTypes().size() == 1;
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ClassAnnotatedItemTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ClassAnnotatedItemTest.java 2008-11-12 21:09:31 UTC (rev 296)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ClassAnnotatedItemTest.java 2008-11-13 09:42:14 UTC (rev 297)
@@ -23,7 +23,7 @@
AnnotatedClass<Order> annotatedElement = new SimpleAnnotatedClass<Order>(Order.class);
assert annotatedElement.getAnnotations().size() == 1;
assert annotatedElement.getAnnotation(Production.class) != null;
- assert annotatedElement.getAnnotatedClass().equals(Order.class);
+ assert annotatedElement.getType().equals(Order.class);
}
@Test
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeferredEventNotificationTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeferredEventNotificationTest.java 2008-11-12 21:09:31 UTC (rev 296)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeferredEventNotificationTest.java 2008-11-13 09:42:14 UTC (rev 297)
@@ -4,21 +4,18 @@
import java.lang.annotation.Annotation;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
import javax.webbeans.Observes;
import javax.webbeans.Standard;
import org.jboss.webbeans.bean.SimpleBean;
-import org.jboss.webbeans.introspector.AnnotatedClass;
-import org.jboss.webbeans.introspector.impl.InjectableMethod;
+import org.jboss.webbeans.introspector.AnnotatedMethod;
import org.jboss.webbeans.introspector.impl.SimpleAnnotatedClass;
+import org.jboss.webbeans.introspector.impl.SimpleAnnotatedMethod;
import org.jboss.webbeans.test.annotations.AnotherDeploymentType;
import org.jboss.webbeans.test.annotations.Asynchronous;
import org.jboss.webbeans.test.beans.Tuna;
-import org.jboss.webbeans.test.bindings.AsynchronousAnnotationLiteral;
import org.testng.annotations.Test;
/**
@@ -68,15 +65,16 @@
// invoked which in turn invokes the observer. Here the mock observer
// is used to keep track of the event being fired.
SimpleBean<Tuna> tuna;
- InjectableMethod<Object> om;
+ AnnotatedMethod<Object> om;
// Create an observer with known binding types
- Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
- annotations.put(Asynchronous.class, new AsynchronousAnnotationLiteral());
- AnnotatedClass<Tuna> annotatedItem = new SimpleAnnotatedClass<Tuna>(Tuna.class, annotations);
+ //Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
+ //annotations.put(Asynchronous.class, new AsynchronousAnnotationLiteral());
+ //AnnotatedClass<Tuna> annotatedItem = new SimpleAnnotatedClass<Tuna>(Tuna.class, annotations);
+ // TODO This should test a real class
tuna = createSimpleBean(Tuna.class, manager);
- om = new InjectableMethod<Object>(AnObserver.class.getMethod("observe", new Class[] { Event.class }));
+ om = new SimpleAnnotatedMethod<Object>(AnObserver.class.getMethod("observe", new Class[] { Event.class }), new SimpleAnnotatedClass<AnObserver>(AnObserver.class));
AnObserver observerInstance = new AnObserver();
// TODO Fix this Observer<Event> observer = new MockObserverImpl<Event>(tuna, om, Event.class);
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeploymentTypeTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeploymentTypeTest.java 2008-11-12 21:09:31 UTC (rev 296)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeploymentTypeTest.java 2008-11-13 09:42:14 UTC (rev 297)
@@ -4,9 +4,7 @@
import java.lang.annotation.Annotation;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
import javax.webbeans.DefinitionException;
import javax.webbeans.DeploymentException;
@@ -15,21 +13,13 @@
import javax.webbeans.UnsatisfiedDependencyException;
import javax.webbeans.manager.Bean;
-import org.jboss.webbeans.introspector.AnnotatedClass;
-import org.jboss.webbeans.introspector.impl.SimpleAnnotatedClass;
import org.jboss.webbeans.test.annotations.AnotherDeploymentType;
-import org.jboss.webbeans.test.annotations.FishStereotype;
import org.jboss.webbeans.test.annotations.HornedAnimalDeploymentType;
-import org.jboss.webbeans.test.beans.Antelope;
import org.jboss.webbeans.test.beans.RedSnapper;
import org.jboss.webbeans.test.beans.Reindeer;
import org.jboss.webbeans.test.beans.Rhinoceros;
-import org.jboss.webbeans.test.beans.SeaBass;
-import org.jboss.webbeans.test.beans.Tuna;
import org.jboss.webbeans.test.beans.broken.BeanWithTooManyDeploymentTypes;
import org.jboss.webbeans.test.beans.broken.Gazelle;
-import org.jboss.webbeans.test.bindings.AnotherDeploymentTypeAnnotationLiteral;
-import org.jboss.webbeans.test.bindings.FishStereotypeAnnotationLiteral;
import org.testng.annotations.Test;
@SpecVersion("PDR")
@@ -69,9 +59,9 @@
@Test(groups={"stub", "webbeansxml"}) @SpecAssertion(section="2.5.4")
public void testXmlDeploymentTypeOverridesJava()
{
- Map<Class<? extends Annotation>, Annotation> xmlDefinedDeploymentTypeAnnotations = new HashMap<Class<? extends Annotation>, Annotation>();
- xmlDefinedDeploymentTypeAnnotations.put(AnotherDeploymentType.class, new AnotherDeploymentTypeAnnotationLiteral());
- AnnotatedClass<BeanWithTooManyDeploymentTypes> xmlDefinedDeploymentTypeAnnotatedItem = new SimpleAnnotatedClass<BeanWithTooManyDeploymentTypes>(BeanWithTooManyDeploymentTypes.class, xmlDefinedDeploymentTypeAnnotations);
+ //Map<Class<? extends Annotation>, Annotation> xmlDefinedDeploymentTypeAnnotations = new HashMap<Class<? extends Annotation>, Annotation>();
+ //xmlDefinedDeploymentTypeAnnotations.put(AnotherDeploymentType.class, new AnotherDeploymentTypeAnnotationLiteral());
+ //AnnotatedClass<BeanWithTooManyDeploymentTypes> xmlDefinedDeploymentTypeAnnotatedItem = new SimpleAnnotatedClass<BeanWithTooManyDeploymentTypes>(BeanWithTooManyDeploymentTypes.class, xmlDefinedDeploymentTypeAnnotations);
//SimpleBean<BeanWithTooManyDeploymentTypes> model = createSimpleBean(BeanWithTooManyDeploymentTypes.class, xmlDefinedDeploymentTypeAnnotatedItem, manager);
//assert model.getDeploymentType().equals(AnotherDeploymentType.class);
@@ -83,7 +73,7 @@
@Test(groups={"stub", "webbeansxml"}) @SpecAssertion(section="2.5.4")
public void testXmlRespectsJavaDeploymentType()
{
- AnnotatedClass<Tuna> annotatedItem = new SimpleAnnotatedClass<Tuna>(Tuna.class, new HashMap<Class<? extends Annotation>, Annotation>());
+ //AnnotatedClass<Tuna> annotatedItem = new SimpleAnnotatedClass<Tuna>(Tuna.class, new HashMap<Class<? extends Annotation>, Annotation>());
//SimpleBean<Tuna> tuna = createSimpleBean(Tuna.class, annotatedItem, manager);
//assert tuna.getDeploymentType().equals(AnotherDeploymentType.class);
assert false;
@@ -92,7 +82,7 @@
@Test(groups={"stub", "webbeansxml"}) @SpecAssertion(section="2.5.5")
public void testXmlDefaultDeploymentType()
{
- AnnotatedClass<Antelope> antelopeAnnotatedItem = new SimpleAnnotatedClass<Antelope>(Antelope.class, new HashMap<Class<? extends Annotation>, Annotation>());
+ //AnnotatedClass<Antelope> antelopeAnnotatedItem = new SimpleAnnotatedClass<Antelope>(Antelope.class, new HashMap<Class<? extends Annotation>, Annotation>());
//SimpleBean<Antelope> antelope = createSimpleBean(Antelope.class, antelopeAnnotatedItem, manager);
// assert antelope.getDeploymentType().equals(Production.class);
assert false;
@@ -108,9 +98,9 @@
@Test(groups={"stub", "webbeansxml"}) @SpecAssertion(section="2.5.5")
public void testDeploymentTypeSpecifiedAndStereotyped()
{
- Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
- annotations.put(FishStereotype.class, new FishStereotypeAnnotationLiteral());
- AnnotatedClass<SeaBass> annotatedItem = new SimpleAnnotatedClass<SeaBass>(SeaBass.class, annotations);
+ //Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
+ //annotations.put(FishStereotype.class, new FishStereotypeAnnotationLiteral());
+ //AnnotatedClass<SeaBass> annotatedItem = new SimpleAnnotatedClass<SeaBass>(SeaBass.class, annotations);
//SimpleBean<SeaBass> trout = createSimpleBean(SeaBass.class, annotatedItem, manager);
//assert trout.getScopeType().equals(RequestScoped.class);
assert false;
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InstantiationByNameTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InstantiationByNameTest.java 2008-11-12 21:09:31 UTC (rev 296)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InstantiationByNameTest.java 2008-11-13 09:42:14 UTC (rev 297)
@@ -6,7 +6,10 @@
import javax.webbeans.manager.Bean;
import org.jboss.webbeans.ResolutionManager;
-import org.jboss.webbeans.introspector.impl.InjectableField;
+import org.jboss.webbeans.introspector.AnnotatedClass;
+import org.jboss.webbeans.introspector.AnnotatedField;
+import org.jboss.webbeans.introspector.impl.SimpleAnnotatedClass;
+import org.jboss.webbeans.introspector.impl.SimpleAnnotatedField;
import org.jboss.webbeans.test.beans.Cod;
import org.jboss.webbeans.test.beans.FishFarm;
import org.jboss.webbeans.test.beans.Haddock;
@@ -21,10 +24,12 @@
public class InstantiationByNameTest extends AbstractTest
{
+ private AnnotatedClass<FishFarm> fishFarmClass = new SimpleAnnotatedClass<FishFarm>(FishFarm.class);
+
@Test(groups="resolution") @SpecAssertion(section="4.10")
public void testNoWebBeansFound() throws Exception
{
- InjectableField<ScottishFish> whiteScottishFishField = new InjectableField<ScottishFish>(FishFarm.class.getDeclaredField("whiteScottishFish"));
+ AnnotatedField<ScottishFish> whiteScottishFishField = new SimpleAnnotatedField<ScottishFish>(FishFarm.class.getDeclaredField("whiteScottishFish"), fishFarmClass);
Bean<Cod> codBean = createSimpleBean(Cod.class, manager);
Bean<Salmon> salmonBean = createSimpleBean(Salmon.class, manager);
manager.addBean(codBean);
@@ -39,7 +44,7 @@
@Test(expectedExceptions=AmbiguousDependencyException.class) @SpecAssertion(section="4.10.1")
public void testAmbiguousDependencies() throws Exception
{
- InjectableField<ScottishFish> whiteScottishFishField = new InjectableField<ScottishFish>(FishFarm.class.getDeclaredField("whiteScottishFish"));
+ AnnotatedField<ScottishFish> whiteScottishFishField = new SimpleAnnotatedField<ScottishFish>(FishFarm.class.getDeclaredField("whiteScottishFish"), fishFarmClass);
Bean<Cod> codBean = createSimpleBean(Cod.class, manager);
Bean<Salmon> salmonBean = createSimpleBean(Salmon.class, manager);
Bean<Sole> soleBean = createSimpleBean(Sole.class, manager);
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InstantiationByTypeTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InstantiationByTypeTest.java 2008-11-12 21:09:31 UTC (rev 296)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InstantiationByTypeTest.java 2008-11-13 09:42:14 UTC (rev 297)
@@ -11,7 +11,10 @@
import org.jboss.webbeans.ResolutionManager;
import org.jboss.webbeans.bindings.CurrentAnnotationLiteral;
-import org.jboss.webbeans.introspector.impl.InjectableField;
+import org.jboss.webbeans.introspector.AnnotatedClass;
+import org.jboss.webbeans.introspector.AnnotatedField;
+import org.jboss.webbeans.introspector.impl.SimpleAnnotatedClass;
+import org.jboss.webbeans.introspector.impl.SimpleAnnotatedField;
import org.jboss.webbeans.test.annotations.Whitefish;
import org.jboss.webbeans.test.beans.Cod;
import org.jboss.webbeans.test.beans.FishFarm;
@@ -28,6 +31,8 @@
public class InstantiationByTypeTest extends AbstractTest
{
+ private AnnotatedClass<FishFarm> fishFarmClass = new SimpleAnnotatedClass<FishFarm>(FishFarm.class);
+
@Test(groups={"resolution", "beanLifecycle"}) @SpecAssertion(section="4.9")
public void testCurrentBindingTypeAssumed()
{
@@ -51,7 +56,7 @@
@Test(expectedExceptions=AmbiguousDependencyException.class) @SpecAssertion(section="4.9")
public void testAmbiguousDependencies() throws Exception
{
- InjectableField<ScottishFish> whiteScottishFishField = new InjectableField<ScottishFish>(FishFarm.class.getDeclaredField("whiteScottishFish"));
+ AnnotatedField<ScottishFish> whiteScottishFishField = new SimpleAnnotatedField<ScottishFish>(FishFarm.class.getDeclaredField("whiteScottishFish"), fishFarmClass);
Bean<Cod> codBean = createSimpleBean(Cod.class, manager);
Bean<Salmon> salmonBean = createSimpleBean(Salmon.class, manager);
Bean<Sole> soleBean = createSimpleBean(Sole.class, manager);
@@ -69,7 +74,7 @@
@Test(expectedExceptions=UnsatisfiedDependencyException.class) @SpecAssertion(section="4.9")
public void testUnsatisfiedDependencies() throws Exception
{
- InjectableField<ScottishFish> whiteScottishFishField = new InjectableField<ScottishFish>(FishFarm.class.getDeclaredField("whiteScottishFish"));
+ AnnotatedField<ScottishFish> whiteScottishFishField = new SimpleAnnotatedField<ScottishFish>(FishFarm.class.getDeclaredField("whiteScottishFish"), fishFarmClass);
Bean<Cod> codBean = createSimpleBean(Cod.class, manager);
Bean<Salmon> salmonBean = createSimpleBean(Salmon.class, manager);
Bean<Sole> soleBean = createSimpleBean(Sole.class, manager);
@@ -87,7 +92,7 @@
@Test(expectedExceptions=UnproxyableDependencyException.class) @SpecAssertion(section="4.9")
public void testUnproxyableDependencies() throws Exception
{
- InjectableField<Plaice> plaiceField = new InjectableField<Plaice>(PlaiceFarm.class.getDeclaredField("plaice"));
+ AnnotatedField<Plaice> plaiceField = new SimpleAnnotatedField<Plaice>(PlaiceFarm.class.getDeclaredField("plaice"), fishFarmClass);
Bean<Plaice> plaiceBean = createSimpleBean(Plaice.class, manager);
manager.addBean(plaiceBean);
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NameTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NameTest.java 2008-11-12 21:09:31 UTC (rev 296)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NameTest.java 2008-11-13 09:42:14 UTC (rev 297)
@@ -2,24 +2,13 @@
import static org.jboss.webbeans.test.util.Util.createSimpleBean;
-import java.lang.annotation.Annotation;
-import java.util.HashMap;
-import java.util.Map;
-
import javax.webbeans.DefinitionException;
-import javax.webbeans.Named;
import org.jboss.webbeans.bean.SimpleBean;
-import org.jboss.webbeans.bindings.NamedAnnotationLiteral;
-import org.jboss.webbeans.introspector.AnnotatedClass;
-import org.jboss.webbeans.introspector.impl.SimpleAnnotatedClass;
-import org.jboss.webbeans.test.annotations.RiverFishStereotype;
-import org.jboss.webbeans.test.beans.Cod;
import org.jboss.webbeans.test.beans.Haddock;
import org.jboss.webbeans.test.beans.Moose;
import org.jboss.webbeans.test.beans.RedSnapper;
import org.jboss.webbeans.test.beans.SeaBass;
-import org.jboss.webbeans.test.bindings.RiverFishStereotypeAnnotationLiteral;
import org.testng.annotations.Test;
@SpecVersion("PDR")
@@ -42,7 +31,7 @@
@Test(groups={"stub", "webbeansxml"}) @SpecAssertion(section="2.6.2")
public void testNonDefaultXmlNamed()
{
- Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
+ /*Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
annotations.put(Named.class, new NamedAnnotationLiteral(){
public String value()
@@ -51,7 +40,7 @@
}
});
- AnnotatedClass<SeaBass> annotatedItem = new SimpleAnnotatedClass<SeaBass>(SeaBass.class, annotations);
+ AnnotatedClass<SeaBass> annotatedItem = new SimpleAnnotatedClass<SeaBass>(SeaBass.class, annotations);*/
//SimpleBean<SeaBass> trout = createSimpleBean(SeaBass.class, annotatedItem, manager);
//assert trout.getName().equals("aTrout");
@@ -61,7 +50,7 @@
@Test(groups={"stub", "webbeansxml"}) @SpecAssertion(section="2.6.2")
public void testXmlNamedOverridesJavaNamed()
{
- Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
+ /*Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
annotations.put(Named.class, new NamedAnnotationLiteral(){
public String value()
@@ -70,7 +59,7 @@
}
});
- AnnotatedClass<Cod> annotatedItem = new SimpleAnnotatedClass<Cod>(Cod.class, annotations);
+ AnnotatedClass<Cod> annotatedItem = new SimpleAnnotatedClass<Cod>(Cod.class, annotations);*/
//SimpleBean<Cod> cod = createSimpleBean(Cod.class, annotatedItem, manager);
//assert cod.getName().equals("aTrout");
@@ -80,8 +69,8 @@
@Test(groups={"stub", "webbeansxml"}) @SpecAssertion(section={"2.6.2", "2.6.3"})
public void testJavaNamedUsedWhenNoXmlSpecified()
{
- Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
- AnnotatedClass<Cod> annotatedItem = new SimpleAnnotatedClass<Cod>(Cod.class, annotations);
+ //Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
+ //AnnotatedClass<Cod> annotatedItem = new SimpleAnnotatedClass<Cod>(Cod.class, annotations);
//SimpleBean<Cod> cod = createSimpleBean(Cod.class, annotatedItem, manager);
//assert cod.getName().equals("whitefish");
@@ -99,7 +88,7 @@
@Test(groups={"stub", "webbeansxml"}) @SpecAssertion(section="2.6.3")
public void testDefaultXmlNamed()
{
- Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
+ /*Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
annotations.put(Named.class, new NamedAnnotationLiteral() {
public String value()
@@ -108,7 +97,7 @@
}
});
- AnnotatedClass<SeaBass> annotatedItem = new SimpleAnnotatedClass<SeaBass>(SeaBass.class, annotations);
+ AnnotatedClass<SeaBass> annotatedItem = new SimpleAnnotatedClass<SeaBass>(SeaBass.class, annotations);*/
//SimpleBean<SeaBass> trout = createSimpleBean(SeaBass.class, annotatedItem, manager);
//assert trout.getName() != null;
@@ -141,9 +130,9 @@
@Test(groups={"stub", "webbeansxml"}) @SpecAssertion(section="2.6.4")
public void testNotNamedInStereotype()
{
- Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
+ /*Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
annotations.put(RiverFishStereotype.class, new RiverFishStereotypeAnnotationLiteral());
- AnnotatedClass<SeaBass> annotatedItem = new SimpleAnnotatedClass<SeaBass>(SeaBass.class, annotations);
+ AnnotatedClass<SeaBass> annotatedItem = new SimpleAnnotatedClass<SeaBass>(SeaBass.class, annotations);*/
//SimpleBean<SeaBass> model = createSimpleBean(SeaBass.class, annotatedItem, manager);
//assert model.getName() == null;
assert false;
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NormalContextTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NormalContextTest.java 2008-11-12 21:09:31 UTC (rev 296)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NormalContextTest.java 2008-11-13 09:42:14 UTC (rev 297)
@@ -73,13 +73,5 @@
ProducerMethodBean<Tarantula> shelobBean = createProducerMethodBean(Tarantula.class, nullProducer, manager, producer);
assert shelobBean.create() == null;
}
-
- @Test(groups={"contexts", "beanDestruction"})
- public void testDestroy() {
- Bean<Tuna> tunaBean = Util.createSimpleBean(Tuna.class, manager);
- assert context.get(tunaBean, true) instanceof Tuna;
- ((AbstractContext)context).destroy(manager);
- assert context.get(tunaBean, false) == null;
- }
}
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ObserverTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ObserverTest.java 2008-11-12 21:09:31 UTC (rev 296)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ObserverTest.java 2008-11-13 09:42:14 UTC (rev 297)
@@ -3,21 +3,18 @@
import java.lang.annotation.Annotation;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
import javax.webbeans.Observes;
import javax.webbeans.Standard;
import org.jboss.webbeans.bean.SimpleBean;
-import org.jboss.webbeans.introspector.AnnotatedClass;
-import org.jboss.webbeans.introspector.impl.InjectableMethod;
+import org.jboss.webbeans.introspector.AnnotatedMethod;
import org.jboss.webbeans.introspector.impl.SimpleAnnotatedClass;
+import org.jboss.webbeans.introspector.impl.SimpleAnnotatedMethod;
import org.jboss.webbeans.test.annotations.AnotherDeploymentType;
import org.jboss.webbeans.test.annotations.Asynchronous;
import org.jboss.webbeans.test.beans.Tuna;
-import org.jboss.webbeans.test.bindings.AsynchronousAnnotationLiteral;
import org.jboss.webbeans.test.mock.MockManagerImpl;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -33,7 +30,7 @@
{
private MockManagerImpl manager;
private SimpleBean<Tuna> tuna;
- private InjectableMethod<Object> om;
+ private AnnotatedMethod<Object> om;
public class SampleEvent
{
@@ -61,11 +58,13 @@
manager.setEnabledDeploymentTypes(enabledDeploymentTypes);
// Create an observer with known binding types
- Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
- annotations.put(Asynchronous.class, new AsynchronousAnnotationLiteral());
- AnnotatedClass<Tuna> annotatedItem = new SimpleAnnotatedClass<Tuna>(Tuna.class, annotations);
+ // TODO This should be a real class being mapped
+ //Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
+ //annotations.put(Asynchronous.class, new AsynchronousAnnotationLiteral());
+ //AnnotatedClass<Tuna> annotatedItem = new SimpleAnnotatedClass<Tuna>(Tuna.class, annotations);
+
tuna = createSimpleBean(Tuna.class, manager);
- om = new InjectableMethod<Object>(AnObserver.class.getMethod("observe", new Class[] { SampleEvent.class }));
+ om = new SimpleAnnotatedMethod<Object>(AnObserver.class.getMethod("observe", new Class[] { SampleEvent.class }), new SimpleAnnotatedClass<AnObserver>(AnObserver.class));
}
/**
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ResolutionByTypeTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ResolutionByTypeTest.java 2008-11-12 21:09:31 UTC (rev 296)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ResolutionByTypeTest.java 2008-11-13 09:42:14 UTC (rev 297)
@@ -4,8 +4,6 @@
import static org.jboss.webbeans.test.util.Util.createSimpleBean;
import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.List;
import java.util.Set;
import javax.webbeans.AnnotationLiteral;
@@ -17,7 +15,10 @@
import org.jboss.webbeans.ResolutionManager;
import org.jboss.webbeans.bean.SimpleBean;
import org.jboss.webbeans.bindings.CurrentAnnotationLiteral;
-import org.jboss.webbeans.introspector.impl.InjectableField;
+import org.jboss.webbeans.introspector.AnnotatedClass;
+import org.jboss.webbeans.introspector.AnnotatedField;
+import org.jboss.webbeans.introspector.impl.SimpleAnnotatedClass;
+import org.jboss.webbeans.introspector.impl.SimpleAnnotatedField;
import org.jboss.webbeans.test.annotations.Expensive;
import org.jboss.webbeans.test.annotations.Whitefish;
import org.jboss.webbeans.test.beans.Animal;
@@ -47,12 +48,14 @@
@SpecVersion("PDR")
public class ResolutionByTypeTest extends AbstractTest
{
+
+ private AnnotatedClass<FishFarm> fishFarmClass = new SimpleAnnotatedClass<FishFarm>(FishFarm.class);
@Test(groups="resolution")
- public void testInjectableField() throws Exception
+ public void testAnnotatedField() throws Exception
{
- InjectableField<Tuna> tuna = new InjectableField<Tuna>(FishFarm.class.getDeclaredField("tuna"));
- assert tuna.getAnnotatedItem().getType().isAssignableFrom(Tuna.class);
+ AnnotatedField<Tuna> tuna = new SimpleAnnotatedField<Tuna>(FishFarm.class.getDeclaredField("tuna"), fishFarmClass);
+ assert tuna.getType().isAssignableFrom(Tuna.class);
assert tuna.getBindingTypes().size() == 1;
assert tuna.getBindingTypes().contains(new CurrentAnnotationLiteral());
assert tuna.getType().isAssignableFrom(Tuna.class);
@@ -61,11 +64,10 @@
@Test(groups="resolution") @SpecAssertion(section="4.9.2")
public void testSingleApiTypeWithCurrent() throws Exception
{
- InjectableField<Tuna> tunaField = new InjectableField<Tuna>(FishFarm.class.getDeclaredField("tuna"));
+ AnnotatedField<Tuna> tunaField = new SimpleAnnotatedField<Tuna>(FishFarm.class.getDeclaredField("tuna"), fishFarmClass);
Bean<Tuna> tunaBean = createSimpleBean(Tuna.class, manager);
- List<Bean<?>> beans = new ArrayList<Bean<?>>();
- beans.add(tunaBean);
- Set<Bean<?>> possibleTargets = tunaField.getMatchingBeans(beans, manager.getModelManager());
+ manager.addBean(tunaBean);
+ Set<Bean<Tuna>> possibleTargets = manager.getResolutionManager().get(tunaField);
assert possibleTargets.size() == 1;
assert possibleTargets.contains(tunaBean);
}
@@ -85,16 +87,14 @@
@Test
public void testOneBindingType() throws Exception
{
- InjectableField<ScottishFish> whiteScottishFishField = new InjectableField<ScottishFish>(FishFarm.class.getDeclaredField("whiteScottishFish"));
+ AnnotatedField<ScottishFish> whiteScottishFishField = new SimpleAnnotatedField<ScottishFish>(FishFarm.class.getDeclaredField("whiteScottishFish"), fishFarmClass);
Bean<Cod> codBean = createSimpleBean(Cod.class, manager);
Bean<Salmon> salmonBean = createSimpleBean(Salmon.class, manager);
Bean<Sole> soleBean = createSimpleBean(Sole.class, manager);
-
- List<Bean<?>> beans = new ArrayList<Bean<?>>();
- beans.add(codBean);
- beans.add(salmonBean);
- beans.add(soleBean);
- Set<Bean<?>> possibleTargets = whiteScottishFishField.getMatchingBeans(beans, manager.getModelManager());
+ manager.addBean(codBean);
+ manager.addBean(salmonBean);
+ manager.addBean(soleBean);
+ Set<Bean<ScottishFish>> possibleTargets = manager.getResolutionManager().get(whiteScottishFishField);
assert possibleTargets.size() == 2;
assert possibleTargets.contains(codBean);
assert possibleTargets.contains(soleBean);
@@ -103,17 +103,16 @@
@Test
public void testABindingType() throws Exception
{
- InjectableField<Animal> whiteChunkyFishField = new InjectableField<Animal>(FishFarm.class.getDeclaredField("realChunkyWhiteFish"));
+ AnnotatedField<Animal> whiteChunkyFishField = new SimpleAnnotatedField<Animal>(FishFarm.class.getDeclaredField("realChunkyWhiteFish"), fishFarmClass);
Bean<Cod> codBean = createSimpleBean(Cod.class, manager);
Bean<Salmon> salmonBean = createSimpleBean(Salmon.class, manager);
Bean<Sole> soleBean = createSimpleBean(Sole.class, manager);
- List<Bean<?>> beans = new ArrayList<Bean<?>>();
- beans.add(codBean);
- beans.add(salmonBean);
- beans.add(soleBean);
- Set<Bean<?>> possibleTargets = whiteChunkyFishField.getMatchingBeans(beans, manager.getModelManager());
+ manager.addBean(codBean);
+ manager.addBean(salmonBean);
+ manager.addBean(soleBean);
+ Set<Bean<Animal>> possibleTargets = manager.getResolutionManager().get(whiteChunkyFishField);
assert possibleTargets.size() == 1;
assert possibleTargets.contains(codBean);
}
@@ -121,13 +120,12 @@
@Test
public void testMultipleApiTypeWithCurrent() throws Exception
{
- InjectableField<Animal> animalField = new InjectableField<Animal>(FishFarm.class.getDeclaredField("animal"));
+ AnnotatedField<Animal> animalField = new SimpleAnnotatedField<Animal>(FishFarm.class.getDeclaredField("animal"), fishFarmClass);
Bean<SeaBass> seaBassBean = createSimpleBean(SeaBass.class, manager);
Bean<Haddock> haddockBean = createSimpleBean(Haddock.class, manager);
- List<Bean<?>> beans = new ArrayList<Bean<?>>();
- beans.add(seaBassBean);
- beans.add(haddockBean);
- Set<Bean<?>> possibleTargets = animalField.getMatchingBeans(beans, manager.getModelManager());
+ manager.addBean(seaBassBean);
+ manager.addBean(haddockBean);
+ Set<Bean<Animal>> possibleTargets = manager.getResolutionManager().get(animalField);
assert possibleTargets.size() == 2;
assert possibleTargets.contains(seaBassBean);
assert possibleTargets.contains(haddockBean);
@@ -194,7 +192,7 @@
@Test(groups="resolution") @SpecAssertion(section="4.9.2")
public void testResolveByTypeWithTypeParameter() throws Exception
{
- InjectableField<Farmer<ScottishFish>> scottishFishFarmerField = new InjectableField<Farmer<ScottishFish>>(FishFarm.class.getDeclaredField("scottishFishFarmer"));
+ AnnotatedField<Farmer<ScottishFish>> scottishFishFarmerField = new SimpleAnnotatedField<Farmer<ScottishFish>>(FishFarm.class.getDeclaredField("scottishFishFarmer"), fishFarmClass);
Bean<ScottishFishFarmer> scottishFishFarmerBean = createSimpleBean(ScottishFishFarmer.class, manager);
Bean<AnimalFarmer> farmerBean = createSimpleBean(AnimalFarmer.class, manager);
@@ -228,7 +226,7 @@
@Test @SpecAssertion(section="4.9.2")
public void testOnlyHighestEnabledPreecedenceWebBeansResolved() throws Exception
{
- InjectableField<Animal> whiteFishField = new InjectableField<Animal>(FishFarm.class.getDeclaredField("whiteFish"));
+ AnnotatedField<Animal> whiteFishField = new SimpleAnnotatedField<Animal>(FishFarm.class.getDeclaredField("whiteFish"), fishFarmClass);
Bean<Cod> codBean = createSimpleBean(Cod.class, manager);
Bean<Sole> soleBean = createSimpleBean(Sole.class, manager);
Bean<Plaice> plaiceBean = createSimpleBean(Plaice.class, manager);
@@ -250,7 +248,7 @@
@Test(groups="resolution") @SpecAssertion(section="4.9.2")
public void testResolveByTypeWithNonBindingMembers() throws Exception
{
- InjectableField<Animal> veryExpensiveWhitefishField = new InjectableField<Animal>(FishFarm.class.getDeclaredField("veryExpensiveWhitefish"));
+ AnnotatedField<Animal> veryExpensiveWhitefishField = new SimpleAnnotatedField<Animal>(FishFarm.class.getDeclaredField("veryExpensiveWhitefish"), fishFarmClass);
Bean<Halibut> halibutBean = createSimpleBean(Halibut.class, manager);
Bean<RoundWhitefish> roundWhiteFishBean = createSimpleBean(RoundWhitefish.class, manager);
Bean<Sole> soleBean = createSimpleBean(Sole.class, manager);
@@ -284,7 +282,7 @@
@Test(groups="resolution") @SpecAssertion(section="4.9.2")
public void testNoWebBeansFound() throws Exception
{
- InjectableField<ScottishFish> whiteScottishFishField = new InjectableField<ScottishFish>(FishFarm.class.getDeclaredField("whiteScottishFish"));
+ AnnotatedField<ScottishFish> whiteScottishFishField = new SimpleAnnotatedField<ScottishFish>(FishFarm.class.getDeclaredField("whiteScottishFish"), fishFarmClass);
Bean<Salmon> salmonBean = createSimpleBean(Salmon.class, manager);
Bean<Sole> soleBean = createSimpleBean(Sole.class, manager);
Bean<Plaice> plaiceBean = createSimpleBean(Plaice.class, manager);
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ScopeTypeTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ScopeTypeTest.java 2008-11-12 21:09:31 UTC (rev 296)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ScopeTypeTest.java 2008-11-13 09:42:14 UTC (rev 297)
@@ -2,35 +2,18 @@
import static org.jboss.webbeans.test.util.Util.createSimpleBean;
-import java.lang.annotation.Annotation;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.webbeans.ConversationScoped;
import javax.webbeans.DefinitionException;
import javax.webbeans.Dependent;
import javax.webbeans.RequestScoped;
import javax.webbeans.manager.Bean;
import org.jboss.webbeans.bean.SimpleBean;
-import org.jboss.webbeans.bindings.ConversationScopedAnnotationLiteral;
-import org.jboss.webbeans.bindings.RequestScopedAnnotationLiteral;
-import org.jboss.webbeans.introspector.AnnotatedClass;
-import org.jboss.webbeans.introspector.impl.SimpleAnnotatedClass;
-import org.jboss.webbeans.test.annotations.AnimalStereotype;
import org.jboss.webbeans.test.annotations.AnotherScopeType;
-import org.jboss.webbeans.test.annotations.FishStereotype;
-import org.jboss.webbeans.test.annotations.RiverFishStereotype;
-import org.jboss.webbeans.test.beans.Antelope;
import org.jboss.webbeans.test.beans.BeanWithTooManyScopeTypes;
-import org.jboss.webbeans.test.beans.Haddock;
import org.jboss.webbeans.test.beans.Mullet;
import org.jboss.webbeans.test.beans.Order;
import org.jboss.webbeans.test.beans.RedSnapper;
import org.jboss.webbeans.test.beans.SeaBass;
-import org.jboss.webbeans.test.bindings.AnimalStereotypeAnnotationLiteral;
-import org.jboss.webbeans.test.bindings.FishStereotypeAnnotationLiteral;
-import org.jboss.webbeans.test.bindings.RiverFishStereotypeAnnotationLiteral;
import org.testng.annotations.Test;
@SpecVersion("PDR")
@@ -78,19 +61,19 @@
@Test(expectedExceptions=DefinitionException.class, groups={"stub", "webbeansxml"})
public void testTooManyScopesSpecifiedInXml()
{
- Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
- annotations.put(RequestScoped.class, new RequestScopedAnnotationLiteral());
- annotations.put(ConversationScoped.class, new ConversationScopedAnnotationLiteral());
- AnnotatedClass<Antelope> antelopeAnnotatedItem = new SimpleAnnotatedClass<Antelope>(Antelope.class, annotations);
+ //Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
+ //annotations.put(RequestScoped.class, new RequestScopedAnnotationLiteral());
+ //annotations.put(ConversationScoped.class, new ConversationScopedAnnotationLiteral());
+ //AnnotatedClass<Antelope> antelopeAnnotatedItem = new SimpleAnnotatedClass<Antelope>(Antelope.class, annotations);
//createSimpleBean(null, antelopeAnnotatedItem, manager);
}
@Test(groups={"stub", "webbeansxml"}) @SpecAssertion(section="2.4.4")
public void testScopeDeclaredInXml()
{
- Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
- annotations.put(RequestScoped.class, new RequestScopedAnnotationLiteral());
- AnnotatedClass<Order> annotatedItem = new SimpleAnnotatedClass<Order>(Order.class, annotations);
+ //Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
+ //annotations.put(RequestScoped.class, new RequestScopedAnnotationLiteral());
+ //AnnotatedClass<Order> annotatedItem = new SimpleAnnotatedClass<Order>(Order.class, annotations);
//SimpleBean<Order> order = createSimpleBean(Order.class, annotatedItem, manager);
//assert order.getScopeType().equals(RequestScoped.class);
@@ -100,8 +83,8 @@
@Test(groups={"stub", "webbeansxml"}) @SpecAssertion(section="2.4.4")
public void testScopeMissingInXml()
{
- Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
- AnnotatedClass<SeaBass> annotatedItem = new SimpleAnnotatedClass<SeaBass>(SeaBass.class, annotations);
+ //Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
+ //AnnotatedClass<SeaBass> annotatedItem = new SimpleAnnotatedClass<SeaBass>(SeaBass.class, annotations);
//SimpleBean<SeaBass> trout =createSimpleBean(SeaBass.class, annotatedItem, manager);
//assert trout.getScopeType().equals(RequestScoped.class);
@@ -111,9 +94,9 @@
@Test(groups={"stub", "webbeansxml"}) @SpecAssertion(section="2.4.4")
public void testScopeDeclaredInXmlOverridesJava()
{
- Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
- annotations.put(ConversationScoped.class, new ConversationScopedAnnotationLiteral());
- AnnotatedClass<SeaBass> annotatedItem = new SimpleAnnotatedClass<SeaBass>(SeaBass.class, annotations);
+ //Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
+ //annotations.put(ConversationScoped.class, new ConversationScopedAnnotationLiteral());
+ //AnnotatedClass<SeaBass> annotatedItem = new SimpleAnnotatedClass<SeaBass>(SeaBass.class, annotations);
//SimpleBean<SeaBass> trout = createSimpleBean(SeaBass.class, annotatedItem, manager);
//assert trout.getScopeType().equals(ConversationScoped.class);
assert false;
@@ -129,41 +112,27 @@
@Test(groups={"stub", "webbeansxml"})@SpecAssertion(section={"2.4.5", "2.7.2"})
public void testScopeSpecifiedAndStereotyped()
{
- Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
- annotations.put(FishStereotype.class, new FishStereotypeAnnotationLiteral());
- AnnotatedClass<SeaBass> annotatedItem = new SimpleAnnotatedClass<SeaBass>(SeaBass.class, annotations);
+ //Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
+ //annotations.put(FishStereotype.class, new FishStereotypeAnnotationLiteral());
+ //AnnotatedClass<SeaBass> annotatedItem = new SimpleAnnotatedClass<SeaBass>(SeaBass.class, annotations);
//SimpleBean<SeaBass> trout = createSimpleBean(SeaBass.class, annotatedItem, manager);
//assert trout.getScopeType().equals(RequestScoped.class);
assert false;
}
- @Test(groups="webbeansxml") @SpecAssertion(section="2.4.5")
+ @Test(groups={"webbeansxml", "stub"}) @SpecAssertion(section="2.4.5")
public void testMutipleIncompatibleScopeStereotypes()
{
- Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
- annotations.put(FishStereotype.class, new FishStereotypeAnnotationLiteral());
- annotations.put(AnimalStereotype.class, new AnimalStereotypeAnnotationLiteral());
- AnnotatedClass<Haddock> annotatedItem = new SimpleAnnotatedClass<Haddock>(Haddock.class, annotations);
-
- boolean exception = false;
- try
- {
- //createSimpleBean(Haddock.class, annotatedItem, manager);
- }
- catch (Exception e)
- {
- exception = true;
- }
- assert exception;
+ assert false;
}
@Test(groups={"stub", "webbeansxml"}) @SpecAssertion(section="2.4.5")
public void testMutipleIncompatibleScopeStereotypesWithScopeSpecified()
{
- Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
+ /*Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
annotations.put(FishStereotype.class, new FishStereotypeAnnotationLiteral());
annotations.put(AnimalStereotype.class, new AnimalStereotypeAnnotationLiteral());
- AnnotatedClass<SeaBass> annotatedItem = new SimpleAnnotatedClass<SeaBass>(SeaBass.class, annotations);
+ AnnotatedClass<SeaBass> annotatedItem = new SimpleAnnotatedClass<SeaBass>(SeaBass.class, annotations);*/
//SimpleBean<SeaBass> trout = createSimpleBean(SeaBass.class, annotatedItem, manager);
//assert trout.getScopeType().equals(RequestScoped.class);
@@ -173,10 +142,10 @@
@Test(groups={"stub", "webbeansxml"})@SpecAssertion(section="2.4.5")
public void testMutipleCompatibleScopeStereotypes()
{
- Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
+ /*Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
annotations.put(FishStereotype.class, new FishStereotypeAnnotationLiteral());
annotations.put(RiverFishStereotype.class, new RiverFishStereotypeAnnotationLiteral());
- AnnotatedClass<Haddock> annotatedItem = new SimpleAnnotatedClass<Haddock>(Haddock.class, annotations);
+ AnnotatedClass<Haddock> annotatedItem = new SimpleAnnotatedClass<Haddock>(Haddock.class, annotations);*/
//SimpleBean<Haddock> haddock = createSimpleBean(Haddock.class, annotatedItem, manager);
//assert haddock.getScopeType().equals(ApplicationScoped.class);
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleBeanModelTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleBeanModelTest.java 2008-11-12 21:09:31 UTC (rev 296)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleBeanModelTest.java 2008-11-13 09:42:14 UTC (rev 297)
@@ -16,7 +16,6 @@
import org.jboss.webbeans.bindings.CurrentAnnotationLiteral;
import org.jboss.webbeans.introspector.AnnotatedConstructor;
import org.jboss.webbeans.introspector.AnnotatedParameter;
-import org.jboss.webbeans.introspector.impl.InjectableParameter;
import org.jboss.webbeans.test.annotations.HeavyDuty;
import org.jboss.webbeans.test.annotations.Motorized;
import org.jboss.webbeans.test.beans.Animal;
@@ -152,13 +151,13 @@
public void testInitializerAnnotatedConstructor()
{
AnnotatedConstructor<Sheep> constructor = createSimpleBean(Sheep.class, manager).getConstructor();
- assert constructor.getDeclaringClass().equals(Sheep.class);
+ assert constructor.getDeclaringClass().getType().equals(Sheep.class);
assert constructor.getParameters().size() == 2;
Map<Class<?>, Set<? extends Annotation>> map = new HashMap<Class<?>, Set<? extends Annotation>>();
for (AnnotatedParameter<Object> parameter : constructor.getParameters())
{
- map.put(parameter.getType(), new InjectableParameter(parameter).getBindingTypes());
+ map.put(parameter.getType(), parameter.getBindingTypes());
}
assert map.containsKey(String.class);
assert map.containsKey(Double.class);
@@ -172,7 +171,7 @@
public void testImplicitConstructorUsed()
{
AnnotatedConstructor<Order> constructor = createSimpleBean(Order.class, manager).getConstructor();
- assert constructor.getDeclaringClass().equals(Order.class);
+ assert constructor.getDeclaringClass().getType().equals(Order.class);
assert constructor.getParameters().size() == 0;
}
@@ -180,7 +179,7 @@
public void testEmptyConstructorUsed()
{
AnnotatedConstructor<Donkey> constructor = createSimpleBean(Donkey.class, manager).getConstructor();
- assert constructor.getDeclaringClass().equals(Donkey.class);
+ assert constructor.getDeclaringClass().getType().equals(Donkey.class);
assert constructor.getParameters().size() == 0;
}
@@ -192,7 +191,7 @@
Map<Class<?>, Set<? extends Annotation>> map = new HashMap<Class<?>, Set<? extends Annotation>>();
for (AnnotatedParameter<Object> parameter : constructor.getParameters())
{
- map.put(parameter.getType(), new InjectableParameter(parameter).getBindingTypes());
+ map.put(parameter.getType(), parameter.getBindingTypes());
}
assert map.containsKey(String.class);
assert map.containsKey(Integer.class);
@@ -246,12 +245,12 @@
public void testBindingTypeAnnotatedConstructor()
{
AnnotatedConstructor<Duck> constructor = createSimpleBean(Duck.class, manager).getConstructor();
- assert constructor.getDeclaringClass().equals(Duck.class);
+ assert constructor.getDeclaringClass().getType().equals(Duck.class);
assert constructor.getParameters().size() == 2;
Map<Class<?>, Set<? extends Annotation>> map = new HashMap<Class<?>, Set<? extends Annotation>>();
for (AnnotatedParameter<Object> parameter : constructor.getParameters())
{
- map.put(parameter.getType(), new InjectableParameter(parameter).getBindingTypes());
+ map.put(parameter.getType(), parameter.getBindingTypes());
}
assert map.containsKey(String.class);
assert map.containsKey(Integer.class);
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/StereotypesTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/StereotypesTest.java 2008-11-12 21:09:31 UTC (rev 296)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/StereotypesTest.java 2008-11-13 09:42:14 UTC (rev 297)
@@ -2,24 +2,18 @@
import static org.jboss.webbeans.test.util.Util.createSimpleBean;
-import java.lang.annotation.Annotation;
import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
import javax.webbeans.DefinitionException;
import javax.webbeans.RequestScoped;
import org.jboss.webbeans.bean.SimpleBean;
-import org.jboss.webbeans.introspector.AnnotatedClass;
-import org.jboss.webbeans.introspector.impl.SimpleAnnotatedClass;
import org.jboss.webbeans.model.StereotypeModel;
import org.jboss.webbeans.test.annotations.AnimalOrderStereotype;
import org.jboss.webbeans.test.annotations.AnimalStereotype;
import org.jboss.webbeans.test.annotations.HornedAnimalDeploymentType;
import org.jboss.webbeans.test.annotations.HornedMammalStereotype;
import org.jboss.webbeans.test.annotations.RequestScopedAnimalStereotype;
-import org.jboss.webbeans.test.annotations.Synchronous;
import org.jboss.webbeans.test.annotations.Tame;
import org.jboss.webbeans.test.annotations.broken.StereotypeWithBindingTypes;
import org.jboss.webbeans.test.annotations.broken.StereotypeWithNonEmptyNamed;
@@ -31,8 +25,6 @@
import org.jboss.webbeans.test.beans.HighlandCow;
import org.jboss.webbeans.test.beans.Order;
import org.jboss.webbeans.test.beans.broken.Carp;
-import org.jboss.webbeans.test.bindings.HornedMamalStereotypeAnnotationLiteral;
-import org.jboss.webbeans.test.bindings.SynchronousAnnotationLiteral;
import org.testng.annotations.Test;
@SpecVersion("PDR")
@@ -166,9 +158,9 @@
@Test(groups={"stub", "webbeansxml"}) @SpecAssertion(section="2.7.3")
public void testStereotypeDeclaredInXmlIgnoresJavaStereotypes()
{
- Map<Class<? extends Annotation>, Annotation> cooXmlAnnotations = new HashMap<Class<? extends Annotation>, Annotation>();
- cooXmlAnnotations.put(HornedMammalStereotype.class, new HornedMamalStereotypeAnnotationLiteral());
- AnnotatedClass<HighlandCow> cooXmlAnnotatedItem = new SimpleAnnotatedClass<HighlandCow>(HighlandCow.class, cooXmlAnnotations);
+ //Map<Class<? extends Annotation>, Annotation> cooXmlAnnotations = new HashMap<Class<? extends Annotation>, Annotation>();
+ //cooXmlAnnotations.put(HornedMammalStereotype.class, new HornedMamalStereotypeAnnotationLiteral());
+ //AnnotatedClass<HighlandCow> cooXmlAnnotatedItem = new SimpleAnnotatedClass<HighlandCow>(HighlandCow.class, cooXmlAnnotations);
/*SimpleBean<HighlandCow> coo = createSimpleBean(HighlandCow.class, cooXmlAnnotatedItem, manager);
assert coo.getDeploymentType().equals(HornedAnimalDeploymentType.class);
@@ -182,10 +174,10 @@
@Test(groups={"stub", "webbeansxml"}) @SpecAssertion(section="2.7.3")
public void testStereotypeDeclaredInXmlIgnoresJavaBindingTypes()
{
- Map<Class<? extends Annotation>, Annotation> cooXmlAnnotations = new HashMap<Class<? extends Annotation>, Annotation>();
- cooXmlAnnotations.put(HornedMammalStereotype.class, new HornedMamalStereotypeAnnotationLiteral());
- cooXmlAnnotations.put(Synchronous.class, new SynchronousAnnotationLiteral());
- AnnotatedClass<HighlandCow> cooXmlAnnotatedItem = new SimpleAnnotatedClass<HighlandCow>(HighlandCow.class, cooXmlAnnotations);
+ //Map<Class<? extends Annotation>, Annotation> cooXmlAnnotations = new HashMap<Class<? extends Annotation>, Annotation>();
+ //cooXmlAnnotations.put(HornedMammalStereotype.class, new HornedMamalStereotypeAnnotationLiteral());
+ //cooXmlAnnotations.put(Synchronous.class, new SynchronousAnnotationLiteral());
+ //AnnotatedClass<HighlandCow> cooXmlAnnotatedItem = new SimpleAnnotatedClass<HighlandCow>(HighlandCow.class, cooXmlAnnotations);
/*SimpleBean<HighlandCow> coo = createSimpleBean(HighlandCow.class, cooXmlAnnotatedItem, manager);
assert coo.getBindingTypes().size() == 1;
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/EnterpriseBeanDeclarationTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/EnterpriseBeanDeclarationTest.java 2008-11-12 21:09:31 UTC (rev 296)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/EnterpriseBeanDeclarationTest.java 2008-11-13 09:42:14 UTC (rev 297)
@@ -12,12 +12,12 @@
import org.jboss.webbeans.test.ejb.model.invalid.Boxer;
import org.jboss.webbeans.test.ejb.model.invalid.Bullmastiff;
import org.jboss.webbeans.test.ejb.model.invalid.Dachshund;
+import org.jboss.webbeans.test.ejb.model.invalid.GreatDane;
import org.jboss.webbeans.test.ejb.model.invalid.Greyhound;
import org.jboss.webbeans.test.ejb.model.invalid.Husky;
import org.jboss.webbeans.test.ejb.model.invalid.IrishTerrier;
import org.jboss.webbeans.test.ejb.model.invalid.Pekingese;
import org.jboss.webbeans.test.ejb.model.invalid.Pug;
-import org.jboss.webbeans.test.ejb.model.valid.GreatDane;
import org.jboss.webbeans.test.ejb.model.valid.Laika;
import org.jboss.webbeans.test.ejb.model.valid.Pitbull;
import org.jboss.webbeans.test.util.Util;
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/EnterpriseBeanRemoveMethodTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/EnterpriseBeanRemoveMethodTest.java 2008-11-12 21:09:31 UTC (rev 296)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/EnterpriseBeanRemoveMethodTest.java 2008-11-13 09:42:14 UTC (rev 297)
@@ -5,13 +5,11 @@
import javax.webbeans.UnremovedException;
import org.jboss.webbeans.bean.EnterpriseBean;
-import org.jboss.webbeans.bean.XmlEnterpriseBean;
import org.jboss.webbeans.contexts.RequestContext;
import org.jboss.webbeans.test.AbstractTest;
import org.jboss.webbeans.test.SpecAssertion;
import org.jboss.webbeans.test.SpecVersion;
import org.jboss.webbeans.test.ejb.model.invalid.Armant;
-import org.jboss.webbeans.test.ejb.model.invalid.ChowChow;
import org.jboss.webbeans.test.ejb.model.invalid.GoldenRetriever;
import org.jboss.webbeans.test.ejb.model.invalid.JackRussellTerrier;
import org.jboss.webbeans.test.ejb.model.invalid.Poodle;
@@ -20,9 +18,9 @@
import org.jboss.webbeans.test.ejb.model.invalid.RussellTerrier;
import org.jboss.webbeans.test.ejb.model.invalid.Saluki;
import org.jboss.webbeans.test.ejb.model.invalid.Spitz;
+import org.jboss.webbeans.test.ejb.model.valid.Koirus;
import org.jboss.webbeans.test.ejb.model.valid.Toller;
import org.jboss.webbeans.test.ejb.model.valid.WelshCorgie;
-import org.jboss.webbeans.test.ejb.model.valid.Koirus;
import org.jboss.webbeans.test.util.Util;
import org.testng.annotations.Test;
@@ -94,8 +92,7 @@
public void testEnterpriseBeanWithoutDestructorUsesNoArgsRemoveAnnotatedMethodAsRemoveMethod()
{
EnterpriseBean<Toller> bean = Util.createEnterpriseBean(Toller.class, manager);
- assert "bye".equals(bean.getRemoveMethod().getAnnotatedItem()
- .getAnnotatedMethod().getName());
+ assert "bye".equals(bean.getRemoveMethod().getName());
}
@Test(groups={"enterpriseBeans", "removeMethod"})
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/EnterpriseBeanSpecializationTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/EnterpriseBeanSpecializationTest.java 2008-11-12 21:09:31 UTC (rev 296)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/EnterpriseBeanSpecializationTest.java 2008-11-13 09:42:14 UTC (rev 297)
@@ -7,7 +7,7 @@
import org.jboss.webbeans.test.AbstractTest;
import org.jboss.webbeans.test.SpecAssertion;
import org.jboss.webbeans.test.SpecVersion;
-import org.jboss.webbeans.test.ejb.model.valid.GreaterDane;
+import org.jboss.webbeans.test.ejb.model.invalid.GreaterDane;
import org.jboss.webbeans.test.ejb.model.valid.Hound;
import org.jboss.webbeans.test.ejb.model.valid.HoundOfBaskerville;
import org.jboss.webbeans.test.util.Util;
Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/invalid/GreatDane.java (from rev 296, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/valid/GreatDane.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/invalid/GreatDane.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/invalid/GreatDane.java 2008-11-13 09:42:14 UTC (rev 297)
@@ -0,0 +1,7 @@
+package org.jboss.webbeans.test.ejb.model.invalid;
+
+
+public class GreatDane
+{
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/invalid/GreatDane.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/invalid/GreaterDane.java (from rev 296, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/valid/GreaterDane.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/invalid/GreaterDane.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/invalid/GreaterDane.java 2008-11-13 09:42:14 UTC (rev 297)
@@ -0,0 +1,11 @@
+package org.jboss.webbeans.test.ejb.model.invalid;
+
+import javax.ejb.Stateless;
+import javax.webbeans.Specializes;
+
+ at Specializes
+ at Stateless
+public class GreaterDane extends GreatDane
+{
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/invalid/GreaterDane.java
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/valid/GreatDane.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/valid/GreatDane.java 2008-11-12 21:09:31 UTC (rev 296)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/valid/GreatDane.java 2008-11-13 09:42:14 UTC (rev 297)
@@ -1,7 +0,0 @@
-package org.jboss.webbeans.test.ejb.model.valid;
-
-
-public class GreatDane
-{
-
-}
Deleted: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/valid/GreaterDane.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/valid/GreaterDane.java 2008-11-12 21:09:31 UTC (rev 296)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/valid/GreaterDane.java 2008-11-13 09:42:14 UTC (rev 297)
@@ -1,11 +0,0 @@
-package org.jboss.webbeans.test.ejb.model.valid;
-
-import javax.ejb.Stateless;
-import javax.webbeans.Specializes;
-
- at Specializes
- at Stateless
-public class GreaterDane extends GreatDane
-{
-
-}
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockObserverImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockObserverImpl.java 2008-11-12 21:09:31 UTC (rev 296)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockObserverImpl.java 2008-11-13 09:42:14 UTC (rev 297)
@@ -2,7 +2,7 @@
import org.jboss.webbeans.bean.EventBean;
import org.jboss.webbeans.event.ObserverImpl;
-import org.jboss.webbeans.introspector.impl.InjectableMethod;
+import org.jboss.webbeans.introspector.AnnotatedMethod;
/**
* An implementation used for unit testing only.
@@ -16,7 +16,7 @@
public MockObserverImpl(EventBean<T> beanModel,
- InjectableMethod<Object> observer, Class<T> eventType)
+ AnnotatedMethod<Object> observer, Class<T> eventType)
{
super(beanModel, observer, eventType);
}
More information about the weld-commits
mailing list