[webbeans-commits] Webbeans SVN: r2313 - in ri/trunk: tests/src/test/java/org/jboss/webbeans/test/unit/lookup and 1 other directory.
webbeans-commits at lists.jboss.org
webbeans-commits at lists.jboss.org
Mon Apr 6 08:21:51 EDT 2009
Author: pete.muir at jboss.org
Date: 2009-04-06 08:21:51 -0400 (Mon, 06 Apr 2009)
New Revision: 2313
Added:
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/lookup/LookupInstanceTest.java
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/AbstractFacadeBean.java
Log:
WBRI-223
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/AbstractFacadeBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/AbstractFacadeBean.java 2009-04-06 12:20:13 UTC (rev 2312)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/AbstractFacadeBean.java 2009-04-06 12:21:51 UTC (rev 2313)
@@ -11,9 +11,13 @@
import org.jboss.webbeans.ManagerImpl;
import org.jboss.webbeans.context.DependentContext;
+import org.jboss.webbeans.log.Log;
+import org.jboss.webbeans.log.Logging;
public abstract class AbstractFacadeBean<T> extends AbstractStandardBean<T>
{
+
+ private static final Log log = Logging.getLog(AbstractFacadeBean.class);
protected AbstractFacadeBean(ManagerImpl manager)
{
@@ -25,16 +29,22 @@
try
{
DependentContext.INSTANCE.setActive(true);
- //TODO Fix to use IP's manager rather than this bean's
InjectionPoint injectionPoint = this.getManager().getInjectionPoint();
- Type genericType = injectionPoint.getType();
- if (genericType instanceof ParameterizedType )
+ if (injectionPoint != null)
{
- Type type = ((ParameterizedType) genericType).getActualTypeArguments()[0];
- if (type instanceof Class)
+ Type genericType = injectionPoint.getType();
+ if (genericType instanceof ParameterizedType )
{
- Class<?> clazz = Class.class.cast(type);
- return newInstance(clazz, fixBindings(injectionPoint.getBindings()));
+ Type type = ((ParameterizedType) genericType).getActualTypeArguments()[0];
+ if (type instanceof Class)
+ {
+ Class<?> clazz = Class.class.cast(type);
+ return newInstance(clazz, fixBindings(injectionPoint.getBindings()));
+ }
+ else
+ {
+ throw new IllegalStateException("Must have concrete type argument " + injectionPoint);
+ }
}
else
{
@@ -43,9 +53,9 @@
}
else
{
- throw new IllegalStateException("Must have concrete type argument " + injectionPoint);
+ log.warn("Dynamic lookup of " + toString() + " is not supported");
+ return null;
}
-
}
finally
{
Added: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/lookup/LookupInstanceTest.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/lookup/LookupInstanceTest.java (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/lookup/LookupInstanceTest.java 2009-04-06 12:21:51 UTC (rev 2313)
@@ -0,0 +1,24 @@
+package org.jboss.webbeans.test.unit.lookup;
+
+import java.util.List;
+
+import javax.inject.Instance;
+import javax.inject.TypeLiteral;
+
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.webbeans.literal.ObtainsLiteral;
+import org.jboss.webbeans.test.unit.AbstractWebBeansTest;
+import org.testng.annotations.Test;
+
+ at Artifact
+public class LookupInstanceTest extends AbstractWebBeansTest
+{
+
+
+ @Test
+ public void testLookupInstance() throws Exception
+ {
+ assert manager.getInstanceByType(new TypeLiteral<Instance<List<?>>>(){}, new ObtainsLiteral()) == null;
+ }
+
+}
Property changes on: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/lookup/LookupInstanceTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
More information about the weld-commits
mailing list