- Revision
- 1303
- Author
- rfscholte
- Date
- 2011-08-21 08:09:07 -0500 (Sun, 21 Aug 2011)
Log Message
Generics complete for TypeVariables
Modified Paths
- trunk/qdox/src/main/java/com/thoughtworks/qdox/builder/ModelBuilder.java
- trunk/qdox/src/main/java/com/thoughtworks/qdox/model/DefaultJavaClass.java
- trunk/qdox/src/main/java/com/thoughtworks/qdox/model/DefaultJavaConstructor.java
- trunk/qdox/src/main/java/com/thoughtworks/qdox/model/DefaultJavaMethod.java
- trunk/qdox/src/main/java/com/thoughtworks/qdox/model/JavaGenericDeclaration.java
- trunk/qdox/src/main/java/com/thoughtworks/qdox/model/JavaMethod.java
- trunk/qdox/src/main/java/com/thoughtworks/qdox/model/JavaMethodDelegate.java
- trunk/qdox/src/main/java/com/thoughtworks/qdox/model/Type.java
Diff
Modified: trunk/qdox/src/main/java/com/thoughtworks/qdox/builder/ModelBuilder.java (1302 => 1303)
--- trunk/qdox/src/main/java/com/thoughtworks/qdox/builder/ModelBuilder.java 2011-08-21 12:15:25 UTC (rev 1302) +++ trunk/qdox/src/main/java/com/thoughtworks/qdox/builder/ModelBuilder.java 2011-08-21 13:09:07 UTC (rev 1303) @@ -37,7 +37,10 @@ import com.thoughtworks.qdox.model.DefaultJavaSource; import com.thoughtworks.qdox.model.DocletTag; import com.thoughtworks.qdox.model.DocletTagFactory; +import com.thoughtworks.qdox.model.JavaClass; +import com.thoughtworks.qdox.model.JavaConstructor; import com.thoughtworks.qdox.model.JavaGenericDeclaration; +import com.thoughtworks.qdox.model.JavaMethod; import com.thoughtworks.qdox.model.JavaParameter; import com.thoughtworks.qdox.model.JavaSource; import com.thoughtworks.qdox.model.Type; @@ -138,9 +141,9 @@ // typeParameters if (def.getTypeParameters() != null) { - List<TypeVariable<?>> typeParams = new LinkedList<TypeVariable<?>>(); + List<TypeVariable<JavaClass>> typeParams = new LinkedList<TypeVariable<JavaClass>>(); for(TypeVariableDef typeVariableDef : def.getTypeParameters()) { - typeParams.add(createTypeVariable(typeVariableDef, newClass)); + typeParams.add(createTypeVariable(typeVariableDef, (JavaClass) newClass)); } newClass.setTypeParameters(typeParams); } @@ -227,9 +230,9 @@ // typeParameters if (def.getTypeParams() != null) { - List<TypeVariable<?>> typeParams = new LinkedList<TypeVariable<?>>(); + List<TypeVariable<JavaConstructor>> typeParams = new LinkedList<TypeVariable<JavaConstructor>>(); for(TypeVariableDef typeVariableDef : def.getTypeParams()) { - typeParams.add(createTypeVariable(typeVariableDef, currentConstructor)); + typeParams.add(createTypeVariable(typeVariableDef, (JavaConstructor) currentConstructor)); } currentConstructor.setTypeParameters(typeParams); } @@ -275,9 +278,9 @@ // typeParameters if (def.getTypeParams() != null) { - List<TypeVariable<?>> typeParams = new LinkedList<TypeVariable<?>>(); + List<TypeVariable<JavaMethod>> typeParams = new LinkedList<TypeVariable<JavaMethod>>(); for(TypeVariableDef typeVariableDef : def.getTypeParams()) { - typeParams.add(createTypeVariable(typeVariableDef, currentMethod)); + typeParams.add(createTypeVariable(typeVariableDef, (JavaMethod) currentMethod)); } currentMethod.setTypeParameters(typeParams); }
Modified: trunk/qdox/src/main/java/com/thoughtworks/qdox/model/DefaultJavaClass.java (1302 => 1303)
--- trunk/qdox/src/main/java/com/thoughtworks/qdox/model/DefaultJavaClass.java 2011-08-21 12:15:25 UTC (rev 1302) +++ trunk/qdox/src/main/java/com/thoughtworks/qdox/model/DefaultJavaClass.java 2011-08-21 13:09:07 UTC (rev 1303) @@ -45,7 +45,7 @@ private Type superClass; private List<Type> implementz = new LinkedList<Type>(); - private List<TypeVariable<?>> typeParameters = new LinkedList<TypeVariable<?>>(); + private List<TypeVariable<JavaClass>> typeParameters = new LinkedList<TypeVariable<JavaClass>>(); //sourceless class can use this property private JavaPackage javaPackage; @@ -225,12 +225,12 @@ /* (non-Javadoc) * @see com.thoughtworks.qdox.model.JavaClass#getTypeParameters() */ - public List<TypeVariable<?>> getTypeParameters() + public List<TypeVariable<JavaClass>> getTypeParameters() { return typeParameters; } - public void setTypeParameters( List<TypeVariable<?>> typeParameters ) + public void setTypeParameters( List<TypeVariable<JavaClass>> typeParameters ) { this.typeParameters = typeParameters; }
Modified: trunk/qdox/src/main/java/com/thoughtworks/qdox/model/DefaultJavaConstructor.java (1302 => 1303)
--- trunk/qdox/src/main/java/com/thoughtworks/qdox/model/DefaultJavaConstructor.java 2011-08-21 12:15:25 UTC (rev 1302) +++ trunk/qdox/src/main/java/com/thoughtworks/qdox/model/DefaultJavaConstructor.java 2011-08-21 13:09:07 UTC (rev 1303) @@ -13,14 +13,14 @@ extends AbstractBaseMethod implements JavaConstructor { - private List<TypeVariable<?>> typeParameters = Collections.emptyList(); + private List<TypeVariable<JavaConstructor>> typeParameters = Collections.emptyList(); - public void setTypeParameters( List<TypeVariable<?>> typeParameters ) + public void setTypeParameters( List<TypeVariable<JavaConstructor>> typeParameters ) { this.typeParameters = typeParameters; } - public List<TypeVariable<?>> getTypeParameters() + public List<TypeVariable<JavaConstructor>> getTypeParameters() { return typeParameters; }
Modified: trunk/qdox/src/main/java/com/thoughtworks/qdox/model/DefaultJavaMethod.java (1302 => 1303)
--- trunk/qdox/src/main/java/com/thoughtworks/qdox/model/DefaultJavaMethod.java 2011-08-21 12:15:25 UTC (rev 1302) +++ trunk/qdox/src/main/java/com/thoughtworks/qdox/model/DefaultJavaMethod.java 2011-08-21 13:09:07 UTC (rev 1303) @@ -28,7 +28,7 @@ public class DefaultJavaMethod extends AbstractBaseMethod implements JavaMethod { private Type returns = Type.VOID; - private List<TypeVariable<?>> typeParameters = Collections.emptyList(); + private List<TypeVariable<JavaMethod>> typeParameters = Collections.emptyList(); /** * The default constructor @@ -63,12 +63,12 @@ return returns; } - public void setTypeParameters( List<TypeVariable<?>> typeParameters ) + public void setTypeParameters( List<TypeVariable<JavaMethod>> typeParameters ) { this.typeParameters = typeParameters; } - public List<TypeVariable<?>> getTypeParameters() + public List<TypeVariable<JavaMethod>> getTypeParameters() { return typeParameters; }
Modified: trunk/qdox/src/main/java/com/thoughtworks/qdox/model/JavaGenericDeclaration.java (1302 => 1303)
--- trunk/qdox/src/main/java/com/thoughtworks/qdox/model/JavaGenericDeclaration.java 2011-08-21 12:15:25 UTC (rev 1302) +++ trunk/qdox/src/main/java/com/thoughtworks/qdox/model/JavaGenericDeclaration.java 2011-08-21 13:09:07 UTC (rev 1303) @@ -35,5 +35,5 @@ * * @return a list of typeParameters, never <code>null</code> */ - List<TypeVariable<?>> getTypeParameters(); + <D extends JavaGenericDeclaration> List<TypeVariable<D>> getTypeParameters(); }
Modified: trunk/qdox/src/main/java/com/thoughtworks/qdox/model/JavaMethod.java (1302 => 1303)
--- trunk/qdox/src/main/java/com/thoughtworks/qdox/model/JavaMethod.java 2011-08-21 12:15:25 UTC (rev 1302) +++ trunk/qdox/src/main/java/com/thoughtworks/qdox/model/JavaMethod.java 2011-08-21 13:09:07 UTC (rev 1303) @@ -129,8 +129,6 @@ */ String getSourceCode(); - List<TypeVariable<?>> getTypeParameters(); - /** * Equivalent of java.lang.reflect.Method.getGenericReturnType() *
Modified: trunk/qdox/src/main/java/com/thoughtworks/qdox/model/JavaMethodDelegate.java (1302 => 1303)
--- trunk/qdox/src/main/java/com/thoughtworks/qdox/model/JavaMethodDelegate.java 2011-08-21 12:15:25 UTC (rev 1302) +++ trunk/qdox/src/main/java/com/thoughtworks/qdox/model/JavaMethodDelegate.java 2011-08-21 13:09:07 UTC (rev 1303) @@ -206,7 +206,7 @@ return originalMethod.getTagsByName( name ); } - public List<TypeVariable<?>> getTypeParameters() + public List<TypeVariable<JavaMethod>> getTypeParameters() { return originalMethod.getTypeParameters(); }
Modified: trunk/qdox/src/main/java/com/thoughtworks/qdox/model/Type.java (1302 => 1303)
--- trunk/qdox/src/main/java/com/thoughtworks/qdox/model/Type.java 2011-08-21 12:15:25 UTC (rev 1302) +++ trunk/qdox/src/main/java/com/thoughtworks/qdox/model/Type.java 2011-08-21 13:09:07 UTC (rev 1303) @@ -24,7 +24,6 @@ import java.util.Iterator; import java.util.LinkedList; import java.util.List; -import java.util.ListIterator; import com.thoughtworks.qdox.library.ClassLibrary; @@ -167,7 +166,7 @@ return result.toString(); } - protected String getGenericValue( List<TypeVariable<?>> typeVariableList ) + protected <D extends JavaGenericDeclaration> String getGenericValue( List<TypeVariable<D>> typeVariableList ) { StringBuffer result = new StringBuffer( getResolvedValue( typeVariableList ) ); for ( Iterator<Type> iter = actualArgumentTypes.iterator(); iter.hasNext(); ) @@ -181,7 +180,7 @@ return result.toString(); } - protected String getResolvedValue( List<TypeVariable<?>> typeParameters ) + protected <D extends JavaGenericDeclaration> String getResolvedValue( List<TypeVariable<D>> typeParameters ) { String result = getValue(); for ( TypeVariable<?> typeParameter : typeParameters ) @@ -195,11 +194,11 @@ return result; } - protected TypeVariable<?> resolve( List<TypeVariable<?>> typeParameters ) + protected <D extends JavaGenericDeclaration> TypeVariable<D> resolve( List<TypeVariable<D>> typeParameters ) { - TypeVariable<?> result = null; + TypeVariable<D> result = null; // String result = getGenericValue(typeParameters); - for ( TypeVariable<?> typeParameter : typeParameters ) + for ( TypeVariable<D> typeParameter : typeParameters ) { if ( typeParameter.getName().equals( getValue() ) ) { @@ -506,7 +505,7 @@ return result.toString(); } - public String getResolvedGenericValue( List<TypeVariable<?>> typeParameters ) + public <D extends JavaGenericDeclaration> String getResolvedGenericValue( List<TypeVariable<D>> typeParameters ) { StringBuffer result = new StringBuffer(); TypeVariable<?> variable = resolve( typeParameters ); @@ -531,10 +530,10 @@ return result.toString(); } - protected String getResolvedGenericFullyQualifiedName( List<TypeVariable<?>> typeParameters ) + protected <D extends JavaGenericDeclaration> String getResolvedGenericFullyQualifiedName( List<TypeVariable<D>> typeParameters ) { StringBuffer result = new StringBuffer(); - TypeVariable<?> variable = resolve( typeParameters ); + TypeVariable<D> variable = resolve( typeParameters ); result.append( variable == null ? getFullyQualifiedName() : variable.getBounds().get(0).getFullyQualifiedName() ); if ( !actualArgumentTypes.isEmpty() ) { @@ -556,9 +555,9 @@ return result.toString(); } - protected String getResolvedFullyQualifiedName( List<TypeVariable<?>> typeParameters ) + protected <D extends JavaGenericDeclaration> String getResolvedFullyQualifiedName( List<TypeVariable<D>> typeParameters ) { - TypeVariable<?> variable = resolve( typeParameters ); + TypeVariable<D> variable = resolve( typeParameters ); return (variable == null ? getFullyQualifiedName() : variable.getBounds().get(0).getFullyQualifiedName() ); } @@ -648,7 +647,7 @@ return resolveRealClass().getCodeBlock(); } - public List<TypeVariable<?>> getTypeParameters() + public <D extends JavaGenericDeclaration> List<TypeVariable<D>> getTypeParameters() { return resolveRealClass().getTypeParameters(); }
To unsubscribe from this list please visit:
