- Revision
- 1382
- Author
- rfscholte
- Date
- 2011-10-09 04:46:30 -0500 (Sun, 09 Oct 2011)
Log Message
Move default implementation of JavaSource to separate package
Modified Paths
- trunk/qdox/src/main/java/com/thoughtworks/qdox/builder/ModelBuilder.java
- trunk/qdox/src/test/java/com/thoughtworks/qdox/library/JavaClassContextTest.java
- trunk/qdox/src/test/java/com/thoughtworks/qdox/model/DefaultJavaClassTest.java
- trunk/qdox/src/test/java/com/thoughtworks/qdox/model/DefaultTypeTest.java
- trunk/qdox/src/test/java/com/thoughtworks/qdox/model/impl/DefaultJavaFieldTest.java
Added Paths
- trunk/qdox/src/main/java/com/thoughtworks/qdox/model/impl/DefaultJavaSource.java
- trunk/qdox/src/test/java/com/thoughtworks/qdox/model/impl/DefaultJavaSourceTest.java
Removed Paths
Diff
Modified: trunk/qdox/src/main/java/com/thoughtworks/qdox/builder/ModelBuilder.java (1381 => 1382)
--- trunk/qdox/src/main/java/com/thoughtworks/qdox/builder/ModelBuilder.java 2011-10-09 09:43:35 UTC (rev 1381) +++ trunk/qdox/src/main/java/com/thoughtworks/qdox/builder/ModelBuilder.java 2011-10-09 09:46:30 UTC (rev 1382) @@ -32,7 +32,6 @@ import com.thoughtworks.qdox.model.DefaultJavaConstructor; import com.thoughtworks.qdox.model.DefaultJavaMethod; import com.thoughtworks.qdox.model.DefaultJavaParameter; -import com.thoughtworks.qdox.model.DefaultJavaSource; import com.thoughtworks.qdox.model.DocletTag; import com.thoughtworks.qdox.model.DocletTagFactory; import com.thoughtworks.qdox.model.JavaAnnotation; @@ -47,6 +46,7 @@ import com.thoughtworks.qdox.model.TypeVariable; import com.thoughtworks.qdox.model.impl.DefaultJavaField; import com.thoughtworks.qdox.model.impl.DefaultJavaPackage; +import com.thoughtworks.qdox.model.impl.DefaultJavaSource; import com.thoughtworks.qdox.parser.structs.AnnoDef; import com.thoughtworks.qdox.parser.structs.ClassDef; import com.thoughtworks.qdox.parser.structs.FieldDef;
Deleted: trunk/qdox/src/main/java/com/thoughtworks/qdox/model/DefaultJavaSource.java (1381 => 1382)
--- trunk/qdox/src/main/java/com/thoughtworks/qdox/model/DefaultJavaSource.java 2011-10-09 09:43:35 UTC (rev 1381) +++ trunk/qdox/src/main/java/com/thoughtworks/qdox/model/DefaultJavaSource.java 2011-10-09 09:46:30 UTC (rev 1382) @@ -1,388 +0,0 @@ -package com.thoughtworks.qdox.model; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.io.Serializable; -import java.net.URL; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import com.thoughtworks.qdox.library.ClassLibrary; -import com.thoughtworks.qdox.writer.DefaultModelWriter; -import com.thoughtworks.qdox.writer.ModelWriter; -import com.thoughtworks.qdox.writer.ModelWriterFactory; - -public class DefaultJavaSource implements JavaSource, Serializable { - - private static final Set<String> PRIMITIVE_TYPES = new HashSet<String>(); - - static { - PRIMITIVE_TYPES.add("boolean"); - PRIMITIVE_TYPES.add("byte"); - PRIMITIVE_TYPES.add("char"); - PRIMITIVE_TYPES.add("double"); - PRIMITIVE_TYPES.add("float"); - PRIMITIVE_TYPES.add("int"); - PRIMITIVE_TYPES.add("long"); - PRIMITIVE_TYPES.add("short"); - PRIMITIVE_TYPES.add("void"); - } - - private final ClassLibrary classLibrary; - private ModelWriterFactory modelWriterFactory; - - private JavaPackage pkg; - private List<String> imports = new LinkedList<String>(); - private List<JavaClass> classes = new LinkedList<JavaClass>(); - private Map<String, String> resolvedTypeCache = new HashMap<String, String>(); - private URL url; - - /** - * Default constructor for the Default JavaSource - * - * @param classLibrary the classLibrary, should not be <code>null</code> - */ - public DefaultJavaSource( ClassLibrary classLibrary ) - { - this.classLibrary = classLibrary; - } - - /** - * @since 1.4 - */ - public void setURL(URL url) { - this.url = "" - } - - /* (non-Javadoc) - * @see com.thoughtworks.qdox.model.JavaSource#getURL() - */ - public URL getURL() { - return url; - } - - /* (non-Javadoc) - * @see com.thoughtworks.qdox.model.JavaSource#getPackage() - */ - public JavaPackage getPackage() { - return pkg; - } - - public void setPackage(JavaPackage pkg) { - this.pkg = pkg; - } - - public void addImport(String imp) { - imports.add(imp); - } - - /* (non-Javadoc) - * @see com.thoughtworks.qdox.model.JavaSource#getImports() - */ - public List<String> getImports() { - return imports; - } - - public void addClass(JavaClass cls) { - classes.add(cls); - } - - /* (non-Javadoc) - * @see com.thoughtworks.qdox.model.JavaSource#getClasses() - */ - public List<JavaClass> getClasses() { - return Collections.unmodifiableList( classes ); - } - - /* (non-Javadoc) - * @see com.thoughtworks.qdox.model.JavaSource#getCodeBlock() - */ - public String getCodeBlock() { - return getModelWriter().writeSource( this ).toString(); - } - - public String toString() { - return getCodeBlock(); - } - - /* - * (non-Javadoc) - * @see com.thoughtworks.qdox.model.JavaSource#resolveType(java.lang.String) - */ - public String resolveType( String typeName ) - { - return resolveFullyQualifiedName( typeName ); - } - - /* - * (non-Javadoc) - * @see com.thoughtworks.qdox.model.JavaClassParent#resolveFullyQualifiedName(java.lang.String) - */ - public String resolveFullyQualifiedName( String name ) - { - String result = resolvedTypeCache.get( name ); - if ( result == null ) - { - result = resolveTypeInternal( name ); - if ( result != null ) - { - resolvedTypeCache.put( name, result ); - } - } - return result; - } - - /* - * (non-Javadoc) - * @see com.thoughtworks.qdox.model.JavaClassParent#resolveCanonicalName(java.lang.String) - */ - public String resolveCanonicalName( String name ) - { - String className = resolveFullyQualifiedName( name ); - String result = null; - if ( className != null ) - { - result = className.replace( '$', '.' ); - } - return result; - } - - /** - * Resolves a type name - * <p> - * Follows the <a href="" - * Java Language Specification, Version 3.0</a>. - * <p> - * Current resolution order is: - * <ol> - * <li>Single-Type-Import Declaration</li> - * <li>Type-Import-on-Demand Declaration</li> - * <li>Automatic Imports</li> - * </ol> - * - * @param typeName the name to resolve - * @return the resolved type name, otherwise <code>null</code> - */ - private String resolveTypeInternal(String typeName) { - String resolvedName = null; - - lookup : { - // primitive types - if(PRIMITIVE_TYPES.contains( typeName )) { - resolvedName = typeName; - break lookup; - } - - String outerName = typeName; - String nestedName = typeName.replace('.', '$'); - int dotpos = typeName.indexOf( '.' ); - - if(dotpos >= 0) { - outerName = typeName.substring( 0, dotpos ); - } - - // Check single-type-import with fully qualified name - resolvedName = resolveImportedType( typeName, nestedName, true ); - - if(resolvedName != null) { - break lookup; - } - - // Check single-type-import with outer name - resolvedName = resolveImportedType( outerName, nestedName, false ); - - if(resolvedName != null) { - break lookup; - } - - // check for class in the same package - if (getPackage() != null) { - resolvedName = resolveFullyQualifiedType( getPackageName() + '.' + typeName ); - - if(resolvedName != null) { - break lookup; - } - } - - // check for a class globally - resolvedName = resolveFullyQualifiedType( typeName ); - - if(resolvedName != null) { - break lookup; - } - - // check for a class in the same package - resolvedName = resolveFromLibrary( getClassNamePrefix() + nestedName ); - if(resolvedName != null) { - break lookup; - } - - // try java.lang.* - resolvedName = resolveFromLibrary( "java.lang." + nestedName ); - if(resolvedName != null) { - break lookup; - } - - // Check type-import-on-demand - resolvedName = resolveImportedType( "*", nestedName, false ); - - if(resolvedName != null) { - break lookup; - } - } - - return resolvedName; - } - - private String resolveImportedType( String importSpec, String typeName, boolean fullMatch ) { - String resolvedName = null; - String dotSuffix = "." + importSpec; - - for (String imprt : getImports()) { - //static imports can refer to inner classes - if( imprt.startsWith( "static " ) ) - { - imprt = imprt.substring( 7 ); - } - if (imprt.equals(importSpec) || (!fullMatch && imprt.endsWith(dotSuffix))) { - String candidateName = imprt.substring( 0, imprt.length() - importSpec.length()) + typeName; - resolvedName = resolveFullyQualifiedType( candidateName ); - if(resolvedName == null && !"*".equals(importSpec)) { - resolvedName = candidateName; - } - if(resolvedName != null) { - break; - } - } - } - - return resolvedName; - } - - private String resolveFromLibrary(String typeName) { - return classLibrary.hasClassReference( typeName ) ? typeName : null; - } - - private String resolveFullyQualifiedType(String typeName) { - int indexOfLastDot = typeName.lastIndexOf('.'); - - if (indexOfLastDot >= 0) { - String root = typeName.substring(0,indexOfLastDot); - String leaf = typeName.substring(indexOfLastDot+1); - String resolvedTypeName = resolveFullyQualifiedType(root + '$' + leaf); - - if(resolvedTypeName != null) { - return resolvedTypeName; - } - } - - if( classLibrary.hasClassReference( typeName )) - { - return typeName; - } - return null; - } - - /* (non-Javadoc) - * @see com.thoughtworks.qdox.model.JavaSource#getClassNamePrefix() - */ - public String getClassNamePrefix() { - return ( pkg == null ? "" : pkg.getName() + '.' ); - } - - public JavaSource getParentSource() { - return this; - } - - /* (non-Javadoc) - * @see com.thoughtworks.qdox.model.JavaSource#getNestedClassByName(java.lang.String) - */ - public JavaClass getNestedClassByName(String name) { - JavaClass result = null; - - for (JavaClass candidateCls : classes) { - if (candidateCls.getName().equals(name)) { - result = candidateCls; - break; - } - } - return result; - } - - public JavaClass getClassByName(String name) - { - JavaClass result = null; - - for ( JavaClass candidateCls : classes ) - { - result = JavaModelUtils.getClassByName( candidateCls, name ); - if ( result != null ) - { - result = candidateCls; - break; - } - } - return result; - } - - /* (non-Javadoc) - * @see com.thoughtworks.qdox.model.JavaSource#getJavaClassLibrary() - */ - public ClassLibrary getJavaClassLibrary() - { - return classLibrary; - } - - /* (non-Javadoc) - * @see com.thoughtworks.qdox.model.JavaSource#getPackageName() - */ - public String getPackageName() - { - return (pkg == null ? "" : pkg.getName()); - } - - /** - * - * @param modelWriterFactory - * @since 2.0 - */ - public void setModelWriterFactory( ModelWriterFactory modelWriterFactory ) - { - this.modelWriterFactory = modelWriterFactory; - } - - private ModelWriter getModelWriter() - { - ModelWriter result; - if (modelWriterFactory != null) { - result = modelWriterFactory.newInstance(); - } - else { - result = new DefaultModelWriter(); - } - return result; - } - -}
Copied: trunk/qdox/src/main/java/com/thoughtworks/qdox/model/impl/DefaultJavaSource.java (from rev 1329, trunk/qdox/src/main/java/com/thoughtworks/qdox/model/DefaultJavaSource.java) (0 => 1382)
--- trunk/qdox/src/main/java/com/thoughtworks/qdox/model/impl/DefaultJavaSource.java (rev 0) +++ trunk/qdox/src/main/java/com/thoughtworks/qdox/model/impl/DefaultJavaSource.java 2011-10-09 09:46:30 UTC (rev 1382) @@ -0,0 +1,392 @@ +package com.thoughtworks.qdox.model.impl; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.Serializable; +import java.net.URL; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.thoughtworks.qdox.library.ClassLibrary; +import com.thoughtworks.qdox.model.JavaClass; +import com.thoughtworks.qdox.model.JavaModelUtils; +import com.thoughtworks.qdox.model.JavaPackage; +import com.thoughtworks.qdox.model.JavaSource; +import com.thoughtworks.qdox.writer.DefaultModelWriter; +import com.thoughtworks.qdox.writer.ModelWriter; +import com.thoughtworks.qdox.writer.ModelWriterFactory; + +public class DefaultJavaSource implements JavaSource, Serializable { + + private static final Set<String> PRIMITIVE_TYPES = new HashSet<String>(); + + static { + PRIMITIVE_TYPES.add("boolean"); + PRIMITIVE_TYPES.add("byte"); + PRIMITIVE_TYPES.add("char"); + PRIMITIVE_TYPES.add("double"); + PRIMITIVE_TYPES.add("float"); + PRIMITIVE_TYPES.add("int"); + PRIMITIVE_TYPES.add("long"); + PRIMITIVE_TYPES.add("short"); + PRIMITIVE_TYPES.add("void"); + } + + private final ClassLibrary classLibrary; + private ModelWriterFactory modelWriterFactory; + + private JavaPackage pkg; + private List<String> imports = new LinkedList<String>(); + private List<JavaClass> classes = new LinkedList<JavaClass>(); + private Map<String, String> resolvedTypeCache = new HashMap<String, String>(); + private URL url; + + /** + * Default constructor for the Default JavaSource + * + * @param classLibrary the classLibrary, should not be <code>null</code> + */ + public DefaultJavaSource( ClassLibrary classLibrary ) + { + this.classLibrary = classLibrary; + } + + /** + * @since 1.4 + */ + public void setURL(URL url) { + this.url = "" + } + + /* (non-Javadoc) + * @see com.thoughtworks.qdox.model.JavaSource#getURL() + */ + public URL getURL() { + return url; + } + + /* (non-Javadoc) + * @see com.thoughtworks.qdox.model.JavaSource#getPackage() + */ + public JavaPackage getPackage() { + return pkg; + } + + public void setPackage(JavaPackage pkg) { + this.pkg = pkg; + } + + public void addImport(String imp) { + imports.add(imp); + } + + /* (non-Javadoc) + * @see com.thoughtworks.qdox.model.JavaSource#getImports() + */ + public List<String> getImports() { + return imports; + } + + public void addClass(JavaClass cls) { + classes.add(cls); + } + + /* (non-Javadoc) + * @see com.thoughtworks.qdox.model.JavaSource#getClasses() + */ + public List<JavaClass> getClasses() { + return Collections.unmodifiableList( classes ); + } + + /* (non-Javadoc) + * @see com.thoughtworks.qdox.model.JavaSource#getCodeBlock() + */ + public String getCodeBlock() { + return getModelWriter().writeSource( this ).toString(); + } + + public String toString() { + return getCodeBlock(); + } + + /* + * (non-Javadoc) + * @see com.thoughtworks.qdox.model.JavaSource#resolveType(java.lang.String) + */ + public String resolveType( String typeName ) + { + return resolveFullyQualifiedName( typeName ); + } + + /* + * (non-Javadoc) + * @see com.thoughtworks.qdox.model.JavaClassParent#resolveFullyQualifiedName(java.lang.String) + */ + public String resolveFullyQualifiedName( String name ) + { + String result = resolvedTypeCache.get( name ); + if ( result == null ) + { + result = resolveTypeInternal( name ); + if ( result != null ) + { + resolvedTypeCache.put( name, result ); + } + } + return result; + } + + /* + * (non-Javadoc) + * @see com.thoughtworks.qdox.model.JavaClassParent#resolveCanonicalName(java.lang.String) + */ + public String resolveCanonicalName( String name ) + { + String className = resolveFullyQualifiedName( name ); + String result = null; + if ( className != null ) + { + result = className.replace( '$', '.' ); + } + return result; + } + + /** + * Resolves a type name + * <p> + * Follows the <a href="" + * Java Language Specification, Version 3.0</a>. + * <p> + * Current resolution order is: + * <ol> + * <li>Single-Type-Import Declaration</li> + * <li>Type-Import-on-Demand Declaration</li> + * <li>Automatic Imports</li> + * </ol> + * + * @param typeName the name to resolve + * @return the resolved type name, otherwise <code>null</code> + */ + private String resolveTypeInternal(String typeName) { + String resolvedName = null; + + lookup : { + // primitive types + if(PRIMITIVE_TYPES.contains( typeName )) { + resolvedName = typeName; + break lookup; + } + + String outerName = typeName; + String nestedName = typeName.replace('.', '$'); + int dotpos = typeName.indexOf( '.' ); + + if(dotpos >= 0) { + outerName = typeName.substring( 0, dotpos ); + } + + // Check single-type-import with fully qualified name + resolvedName = resolveImportedType( typeName, nestedName, true ); + + if(resolvedName != null) { + break lookup; + } + + // Check single-type-import with outer name + resolvedName = resolveImportedType( outerName, nestedName, false ); + + if(resolvedName != null) { + break lookup; + } + + // check for class in the same package + if (getPackage() != null) { + resolvedName = resolveFullyQualifiedType( getPackageName() + '.' + typeName ); + + if(resolvedName != null) { + break lookup; + } + } + + // check for a class globally + resolvedName = resolveFullyQualifiedType( typeName ); + + if(resolvedName != null) { + break lookup; + } + + // check for a class in the same package + resolvedName = resolveFromLibrary( getClassNamePrefix() + nestedName ); + if(resolvedName != null) { + break lookup; + } + + // try java.lang.* + resolvedName = resolveFromLibrary( "java.lang." + nestedName ); + if(resolvedName != null) { + break lookup; + } + + // Check type-import-on-demand + resolvedName = resolveImportedType( "*", nestedName, false ); + + if(resolvedName != null) { + break lookup; + } + } + + return resolvedName; + } + + private String resolveImportedType( String importSpec, String typeName, boolean fullMatch ) { + String resolvedName = null; + String dotSuffix = "." + importSpec; + + for (String imprt : getImports()) { + //static imports can refer to inner classes + if( imprt.startsWith( "static " ) ) + { + imprt = imprt.substring( 7 ); + } + if (imprt.equals(importSpec) || (!fullMatch && imprt.endsWith(dotSuffix))) { + String candidateName = imprt.substring( 0, imprt.length() - importSpec.length()) + typeName; + resolvedName = resolveFullyQualifiedType( candidateName ); + if(resolvedName == null && !"*".equals(importSpec)) { + resolvedName = candidateName; + } + if(resolvedName != null) { + break; + } + } + } + + return resolvedName; + } + + private String resolveFromLibrary(String typeName) { + return classLibrary.hasClassReference( typeName ) ? typeName : null; + } + + private String resolveFullyQualifiedType(String typeName) { + int indexOfLastDot = typeName.lastIndexOf('.'); + + if (indexOfLastDot >= 0) { + String root = typeName.substring(0,indexOfLastDot); + String leaf = typeName.substring(indexOfLastDot+1); + String resolvedTypeName = resolveFullyQualifiedType(root + '$' + leaf); + + if(resolvedTypeName != null) { + return resolvedTypeName; + } + } + + if( classLibrary.hasClassReference( typeName )) + { + return typeName; + } + return null; + } + + /* (non-Javadoc) + * @see com.thoughtworks.qdox.model.JavaSource#getClassNamePrefix() + */ + public String getClassNamePrefix() { + return ( pkg == null ? "" : pkg.getName() + '.' ); + } + + public JavaSource getParentSource() { + return this; + } + + /* (non-Javadoc) + * @see com.thoughtworks.qdox.model.JavaSource#getNestedClassByName(java.lang.String) + */ + public JavaClass getNestedClassByName(String name) { + JavaClass result = null; + + for (JavaClass candidateCls : classes) { + if (candidateCls.getName().equals(name)) { + result = candidateCls; + break; + } + } + return result; + } + + public JavaClass getClassByName(String name) + { + JavaClass result = null; + + for ( JavaClass candidateCls : classes ) + { + result = JavaModelUtils.getClassByName( candidateCls, name ); + if ( result != null ) + { + result = candidateCls; + break; + } + } + return result; + } + + /* (non-Javadoc) + * @see com.thoughtworks.qdox.model.JavaSource#getJavaClassLibrary() + */ + public ClassLibrary getJavaClassLibrary() + { + return classLibrary; + } + + /* (non-Javadoc) + * @see com.thoughtworks.qdox.model.JavaSource#getPackageName() + */ + public String getPackageName() + { + return (pkg == null ? "" : pkg.getName()); + } + + /** + * + * @param modelWriterFactory + * @since 2.0 + */ + public void setModelWriterFactory( ModelWriterFactory modelWriterFactory ) + { + this.modelWriterFactory = modelWriterFactory; + } + + private ModelWriter getModelWriter() + { + ModelWriter result; + if (modelWriterFactory != null) { + result = modelWriterFactory.newInstance(); + } + else { + result = new DefaultModelWriter(); + } + return result; + } + +}
Modified: trunk/qdox/src/test/java/com/thoughtworks/qdox/library/JavaClassContextTest.java (1381 => 1382)
--- trunk/qdox/src/test/java/com/thoughtworks/qdox/library/JavaClassContextTest.java 2011-10-09 09:43:35 UTC (rev 1381) +++ trunk/qdox/src/test/java/com/thoughtworks/qdox/library/JavaClassContextTest.java 2011-10-09 09:46:30 UTC (rev 1382) @@ -3,11 +3,11 @@ import junit.framework.TestCase; import com.thoughtworks.qdox.model.DefaultJavaClass; -import com.thoughtworks.qdox.model.DefaultJavaSource; import com.thoughtworks.qdox.model.JavaClass; import com.thoughtworks.qdox.model.JavaPackage; import com.thoughtworks.qdox.model.JavaSource; import com.thoughtworks.qdox.model.impl.DefaultJavaPackage; +import com.thoughtworks.qdox.model.impl.DefaultJavaSource; public class JavaClassContextTest extends TestCase
Modified: trunk/qdox/src/test/java/com/thoughtworks/qdox/model/DefaultJavaClassTest.java (1381 => 1382)
--- trunk/qdox/src/test/java/com/thoughtworks/qdox/model/DefaultJavaClassTest.java 2011-10-09 09:43:35 UTC (rev 1381) +++ trunk/qdox/src/test/java/com/thoughtworks/qdox/model/DefaultJavaClassTest.java 2011-10-09 09:46:30 UTC (rev 1382) @@ -3,6 +3,7 @@ import java.util.List; import com.thoughtworks.qdox.library.SortedClassLibraryBuilder; +import com.thoughtworks.qdox.model.impl.DefaultJavaSource; public class DefaultJavaClassTest extends JavaClassTest<DefaultJavaClass>
Deleted: trunk/qdox/src/test/java/com/thoughtworks/qdox/model/DefaultJavaSourceTest.java (1381 => 1382)
--- trunk/qdox/src/test/java/com/thoughtworks/qdox/model/DefaultJavaSourceTest.java 2011-10-09 09:43:35 UTC (rev 1381) +++ trunk/qdox/src/test/java/com/thoughtworks/qdox/model/DefaultJavaSourceTest.java 2011-10-09 09:46:30 UTC (rev 1382) @@ -1,40 +0,0 @@ -package com.thoughtworks.qdox.model; - -import java.util.List; - -import com.thoughtworks.qdox.library.ClassLibrary; - -public class DefaultJavaSourceTest extends JavaSourceTest<DefaultJavaSource> -{ - - public DefaultJavaSourceTest( String s ) - { - super( s ); - } - - public DefaultJavaSource newJavaSource( ClassLibrary classLibrary ) - { - return new DefaultJavaSource(classLibrary); - } - - public void setPackage( DefaultJavaSource source, JavaPackage pckg ) - { - source.setPackage( pckg ); - } - - @Override - public void setClasses( DefaultJavaSource source, List<JavaClass> classes ) - { - for(JavaClass cls: classes) { - source.addClass( cls ); - } - } - - @Override - public void setImports( DefaultJavaSource source, List<String> imports ) - { - for(String imprt : imports) { - source.addImport( imprt ); - } - } -}
Modified: trunk/qdox/src/test/java/com/thoughtworks/qdox/model/DefaultTypeTest.java (1381 => 1382)
--- trunk/qdox/src/test/java/com/thoughtworks/qdox/model/DefaultTypeTest.java 2011-10-09 09:43:35 UTC (rev 1381) +++ trunk/qdox/src/test/java/com/thoughtworks/qdox/model/DefaultTypeTest.java 2011-10-09 09:46:30 UTC (rev 1382) @@ -1,6 +1,7 @@ package com.thoughtworks.qdox.model; import com.thoughtworks.qdox.library.ClassLibrary; +import com.thoughtworks.qdox.model.impl.DefaultJavaSource; public class DefaultTypeTest extends TypeTest
Modified: trunk/qdox/src/test/java/com/thoughtworks/qdox/model/impl/DefaultJavaFieldTest.java (1381 => 1382)
--- trunk/qdox/src/test/java/com/thoughtworks/qdox/model/impl/DefaultJavaFieldTest.java 2011-10-09 09:43:35 UTC (rev 1381) +++ trunk/qdox/src/test/java/com/thoughtworks/qdox/model/impl/DefaultJavaFieldTest.java 2011-10-09 09:46:30 UTC (rev 1382) @@ -3,7 +3,6 @@ import java.util.List; import com.thoughtworks.qdox.model.DefaultJavaClass; -import com.thoughtworks.qdox.model.DefaultJavaSource; import com.thoughtworks.qdox.model.JavaClass; import com.thoughtworks.qdox.model.JavaFieldTest; import com.thoughtworks.qdox.model.JavaSource;
Copied: trunk/qdox/src/test/java/com/thoughtworks/qdox/model/impl/DefaultJavaSourceTest.java (from rev 1303, trunk/qdox/src/test/java/com/thoughtworks/qdox/model/DefaultJavaSourceTest.java) (0 => 1382)
--- trunk/qdox/src/test/java/com/thoughtworks/qdox/model/impl/DefaultJavaSourceTest.java (rev 0) +++ trunk/qdox/src/test/java/com/thoughtworks/qdox/model/impl/DefaultJavaSourceTest.java 2011-10-09 09:46:30 UTC (rev 1382) @@ -0,0 +1,43 @@ +package com.thoughtworks.qdox.model.impl; + +import java.util.List; + +import com.thoughtworks.qdox.library.ClassLibrary; +import com.thoughtworks.qdox.model.JavaClass; +import com.thoughtworks.qdox.model.JavaPackage; +import com.thoughtworks.qdox.model.JavaSourceTest; + +public class DefaultJavaSourceTest extends JavaSourceTest<DefaultJavaSource> +{ + + public DefaultJavaSourceTest( String s ) + { + super( s ); + } + + public DefaultJavaSource newJavaSource( ClassLibrary classLibrary ) + { + return new DefaultJavaSource(classLibrary); + } + + public void setPackage( DefaultJavaSource source, JavaPackage pckg ) + { + source.setPackage( pckg ); + } + + @Override + public void setClasses( DefaultJavaSource source, List<JavaClass> classes ) + { + for(JavaClass cls: classes) { + source.addClass( cls ); + } + } + + @Override + public void setImports( DefaultJavaSource source, List<String> imports ) + { + for(String imprt : imports) { + source.addImport( imprt ); + } + } +}
To unsubscribe from this list please visit:
