Title: [1344] trunk/qdox/src/main/java/com/thoughtworks/qdox/model: Refactor Type.resolve(List<TypeVariable<D>>) to a static method
Revision
1344
Author
rfscholte
Date
2011-10-02 07:26:53 -0500 (Sun, 02 Oct 2011)

Log Message

Refactor Type.resolve(List<TypeVariable<D>>) to a static method

Modified Paths

Diff

Modified: trunk/qdox/src/main/java/com/thoughtworks/qdox/model/DefaultJavaMethod.java (1343 => 1344)

--- trunk/qdox/src/main/java/com/thoughtworks/qdox/model/DefaultJavaMethod.java	2011-10-01 17:24:27 UTC (rev 1343)
+++ trunk/qdox/src/main/java/com/thoughtworks/qdox/model/DefaultJavaMethod.java	2011-10-02 12:26:53 UTC (rev 1344)
@@ -356,7 +356,7 @@
                 result.append( "," );
             }
             Type originalType = getParameters().get( paramIndex ).getType();
-            TypeVariable typeVariable = originalType.resolve( getTypeParameters() ); 
+            TypeVariable typeVariable = Type.resolve( originalType, getTypeParameters() ); 
             result.append( typeVariable == null ? originalType.getFullyQualifiedName() : typeVariable.getResolvedFullyQualifiedName() );
         }
         result.append( ")" );

Modified: trunk/qdox/src/main/java/com/thoughtworks/qdox/model/Type.java (1343 => 1344)

--- trunk/qdox/src/main/java/com/thoughtworks/qdox/model/Type.java	2011-10-01 17:24:27 UTC (rev 1343)
+++ trunk/qdox/src/main/java/com/thoughtworks/qdox/model/Type.java	2011-10-02 12:26:53 UTC (rev 1344)
@@ -171,7 +171,7 @@
         StringBuffer result = new StringBuffer( getResolvedValue( typeVariableList ) );
         for ( Iterator<Type> iter = actualArgumentTypes.iterator(); iter.hasNext(); )
         {
-            result.append( iter.next().resolve( typeVariableList ) );
+            result.append( iter.next().resolve( this, typeVariableList ) );
             if ( iter.hasNext() )
             {
                 result.append( "," );
@@ -194,13 +194,13 @@
         return result;
     }
     
-    protected <D extends JavaGenericDeclaration> TypeVariable<D> resolve( List<TypeVariable<D>> typeParameters )
+    protected static <D extends JavaGenericDeclaration> TypeVariable<D> resolve( Type base, List<TypeVariable<D>> typeParameters )
     {
         TypeVariable<D> result = null;
         // String result = getGenericValue(typeParameters);
         for ( TypeVariable<D> typeParameter : typeParameters )
         {
-            if ( typeParameter.getName().equals( getValue() ) )
+            if ( typeParameter.getName().equals( base.getValue() ) )
             {
                 result = typeParameter;
                 break;
@@ -507,7 +507,7 @@
     public <D extends JavaGenericDeclaration> String getResolvedGenericValue( List<TypeVariable<D>> typeParameters )
     {
         StringBuffer result = new StringBuffer();
-        TypeVariable<?> variable = resolve( typeParameters );
+        TypeVariable<?> variable = resolve( this, typeParameters );
         result.append( variable == null ? getValue() : variable.getBounds().get(0).getValue() );
         if ( !actualArgumentTypes.isEmpty() )
         {
@@ -532,7 +532,7 @@
     protected <D extends JavaGenericDeclaration> String getResolvedGenericFullyQualifiedName( List<TypeVariable<D>> typeParameters )
     {
         StringBuffer result = new StringBuffer();
-        TypeVariable<D> variable = resolve( typeParameters );
+        TypeVariable<D> variable = resolve( this, typeParameters );
         result.append( variable == null ? getFullyQualifiedName() : variable.getBounds().get(0).getFullyQualifiedName() );
         if ( !actualArgumentTypes.isEmpty() )
         {
@@ -556,7 +556,7 @@
 
     protected <D extends JavaGenericDeclaration> String getResolvedFullyQualifiedName( List<TypeVariable<D>> typeParameters )
     {
-        TypeVariable<D> variable = resolve( typeParameters );
+        TypeVariable<D> variable = resolve( this, typeParameters );
         return (variable == null ? getFullyQualifiedName() : variable.getBounds().get(0).getFullyQualifiedName() );
     }
 


To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email

Reply via email to