geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r794841 - /geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/ReferenceListRecipe.java
Date Thu, 16 Jul 2009 20:38:24 GMT
Author: gawor
Date: Thu Jul 16 20:38:23 2009
New Revision: 794841

URL: http://svn.apache.org/viewvc?rev=794841&view=rev
Log:
ref-list injection conversion updates

Modified:
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/ReferenceListRecipe.java

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/ReferenceListRecipe.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/ReferenceListRecipe.java?rev=794841&r1=794840&r2=794841&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/ReferenceListRecipe.java
(original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/ReferenceListRecipe.java
Thu Jul 16 20:38:23 2009
@@ -18,13 +18,10 @@
  */
 package org.apache.geronimo.blueprint.container;
 
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
 import java.util.AbstractCollection;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
 import java.util.ListIterator;
@@ -229,17 +226,19 @@
             if (!type.getRawClass().isAssignableFrom(List.class)) {
                 throw new ComponentDefinitionException("<ref-list/> can only be converted
to a List, not " + type);
             }
+            int memberType = metadata.getMemberType();            
             boolean useRef = false;
-            if (type instanceof ParameterizedType) {
-                Type[] args = ((ParameterizedType) type).getActualTypeArguments();
-                if (args != null && args.length == 1) {
-                    useRef = (args[0] == ServiceReference.class);
+            if (type.size() == 1) {
+                useRef = (type.getActualTypeArgument(0).getRawClass() == ServiceReference.class);
+                if ( (useRef && memberType == ReferenceListMetadata.USE_SERVICE_OBJECT)
||
+                     (!useRef && memberType == ReferenceListMetadata.USE_SERVICE_REFERENCE))
{
+                    throw new ComponentDefinitionException("The memeber-type specified is
incompatible with generic injection type");
                 }
             }
             boolean references;
-            if (metadata.getMemberType() == ReferenceListMetadata.USE_SERVICE_REFERENCE)
{
+            if (memberType == ReferenceListMetadata.USE_SERVICE_REFERENCE) {            
   
                 references = true;
-            } else if (metadata.getMemberType() == ReferenceListMetadata.USE_SERVICE_OBJECT)
{
+            } else if (memberType == ReferenceListMetadata.USE_SERVICE_OBJECT) {
                 references = false;
             } else {
                 references = useRef;



Mime
View raw message