- Revision
- 1377
- Author
- rfscholte
- Date
- 2011-10-09 04:12:16 -0500 (Sun, 09 Oct 2011)
Log Message
Restore and bundle some deprecated method from JavaClass to ease migrations
Modified Paths
Diff
Modified: trunk/qdox/src/main/java/com/thoughtworks/qdox/model/DefaultJavaClass.java (1376 => 1377)
--- trunk/qdox/src/main/java/com/thoughtworks/qdox/model/DefaultJavaClass.java 2011-10-08 20:44:51 UTC (rev 1376) +++ trunk/qdox/src/main/java/com/thoughtworks/qdox/model/DefaultJavaClass.java 2011-10-09 09:12:16 UTC (rev 1377) @@ -665,6 +665,15 @@ public List<JavaClass> getNestedClasses() { return classes; } + + public JavaClass getInnerClassByName( String name ) + { + return getNestedClassByName( name ); + } + public List<JavaClass> getInnerClasses() + { + return getNestedClasses(); + } public JavaClass getNestedClassByName(String name) { int separatorIndex = name.indexOf('.');
Modified: trunk/qdox/src/main/java/com/thoughtworks/qdox/model/JavaClass.java (1376 => 1377)
--- trunk/qdox/src/main/java/com/thoughtworks/qdox/model/JavaClass.java 2011-10-08 20:44:51 UTC (rev 1376) +++ trunk/qdox/src/main/java/com/thoughtworks/qdox/model/JavaClass.java 2011-10-09 09:12:16 UTC (rev 1377) @@ -31,8 +31,41 @@ */ public interface JavaClass extends JavaModel, JavaType, JavaClassParent, JavaAnnotatedElement, JavaGenericDeclaration { + + // deprecated methods + // will be removed with QDox-2.0 + + /** + * @deprecated the JavaClass should have the same methods + */ + Type asType(); /** + * @deprecated Use {@link #getNestedClasses()} instead. + */ + List<JavaClass> getClasses(); + + /** + * @deprecated use {@link #getNestedClassByName(String)} instead + */ + JavaClass getInnerClassByName(String name); + + /** + * @deprecated use {@link #getNestedClasses()} instead + */ + List<JavaClass> getInnerClasses(); + + /** + * @deprecated use {@link #getParentSource()} or {@link #getDeclaringClass()} + */ + JavaClassParent getParent(); + + /** + * @deprecated use {@link #resolveCanonicalName(String)} or {@link #resolveFullyQualifiedName(String)} instead + */ + String resolveType( String name ); + + /** * (API description of {@link java.lang.Class#isInterface()}) * <p> * Determines if the specified <code>Class</code> object represents an interface type. @@ -63,6 +96,8 @@ * @since 2.0 */ boolean isAnnotation(); + + JavaClass getDeclaringClass(); JavaType getSuperClass(); @@ -97,8 +132,6 @@ */ JavaPackage getPackage(); - JavaClassParent getParent(); - /** * If this class has a package, the packagename will be returned. * Otherwise an empty String. @@ -114,8 +147,10 @@ * @return <code>true</code> if this class is an inner class, otherwise <code>false</code> */ boolean isInner(); - + /** + * The name can be both absolute (including the package) or relative (matching a subclass or an import). + * * Tries to return the fully qualified name based on the name. * The name tries to match the following: * <ul> @@ -126,14 +161,6 @@ * <li>implicit imports</li> * </ul> * - * @return the resolved name, otherwise <code>null</code>. - * @deprecated use {@link #resolveCanonicalName(String)} or {@link #resolveFullyQualifiedName(String)} instead - */ - String resolveType( String name ); - - /** - * The name can be both absolute (including the package) or relative (matching a subclass or an import). - * * @param name the name to resolve * @return the resolved canonical name, otherwise <code>null</code> * @since 2.0 @@ -143,6 +170,16 @@ /** * The name can be both absolute (including the package) or relative (matching a subclass or an import). * + * Tries to return the fully qualified name based on the name. + * The name tries to match the following: + * <ul> + * <li>primitives or void</li> + * <li>java.lang.*</li> + * <li>inner classes</li> + * <li>explicit imports</li> + * <li>implicit imports</li> + * </ul> + * * @param name the name to resolve * @return the resolved fully qualified name, otherwise <code>null</code> * @since 2.0 @@ -158,13 +195,6 @@ String getClassNamePrefix(); /** - * - * - * @deprecated the JavaClass should have the same methods - */ - Type asType(); - - /** * Equivalent of {@link java.lang.Class#getMethods()} * * @return the methods declared or overridden in this class @@ -291,11 +321,6 @@ JavaField getEnumConstantByName( String name ); /** - * @deprecated Use {@link #getNestedClasses()} instead. - */ - List<JavaClass> getClasses(); - - /** * Equivalent of {@link Class#getDeclaredClasses()} * * @return a list of declared classes, never <code>null</code>
Modified: trunk/qdox/src/main/java/com/thoughtworks/qdox/model/Type.java (1376 => 1377)
--- trunk/qdox/src/main/java/com/thoughtworks/qdox/model/Type.java 2011-10-08 20:44:51 UTC (rev 1376) +++ trunk/qdox/src/main/java/com/thoughtworks/qdox/model/Type.java 2011-10-09 09:12:16 UTC (rev 1377) @@ -66,10 +66,6 @@ return new Type(null, name, dimensions, context); } - public JavaClassParent getJavaClassParent() { - return context; - } - /** * Returns the FQN of an Object or the handler of a Type. * If the name of the can't be resolved based on the imports and the classes on the classpath the name will be returned. @@ -791,15 +787,6 @@ /* * (non-Javadoc) - * @see com.thoughtworks.qdox.model.JavaClass#getParent() - */ - public JavaClassParent getParent() - { - return context; - } - - /* - * (non-Javadoc) * @see com.thoughtworks.qdox.model.JavaClass#getPackageName() */ public String getPackageName() @@ -818,15 +805,6 @@ /* * (non-Javadoc) - * @see com.thoughtworks.qdox.model.JavaClass#resolveType(java.lang.String) - */ - public String resolveType( String name ) - { - return resolveRealClass().resolveType( name ); - } - - /* - * (non-Javadoc) * @see com.thoughtworks.qdox.model.JavaClass#resolveCanonicalName(java.lang.String) */ public String resolveCanonicalName( String name ) @@ -854,15 +832,6 @@ /* * (non-Javadoc) - * @see com.thoughtworks.qdox.model.JavaClass#asType() - */ - public Type asType() - { - return resolveRealClass().asType(); - } - - /* - * (non-Javadoc) * @see com.thoughtworks.qdox.model.JavaClass#getMethods() */ public List<JavaMethod> getMethods() @@ -999,15 +968,6 @@ /* * (non-Javadoc) - * @see com.thoughtworks.qdox.model.JavaClass#getClasses() - */ - public List<JavaClass> getClasses() - { - return resolveRealClass().getClasses(); - } - - /* - * (non-Javadoc) * @see com.thoughtworks.qdox.model.JavaClass#getNestedClasses() */ public List<JavaClass> getNestedClasses() @@ -1186,4 +1146,42 @@ return resolveRealClass().isAbstract(); } + public JavaClass getDeclaringClass() + { + return resolveRealClass().getDeclaringClass(); + } + + // deprecated + public Type asType() { + return resolveRealClass().asType(); + } + + public List<JavaClass> getClasses() + { + return resolveRealClass().getClasses(); + } + + public JavaClass getInnerClassByName( String name ) + { + return resolveRealClass().getInnerClassByName( name ); + } + + public List<JavaClass> getInnerClasses() + { + return resolveRealClass().getInnerClasses(); + } + + public JavaClassParent getParent() + { + return context; + } + + public String resolveType( String name ) + { + return resolveRealClass().resolveType( name ); + } + + public JavaClassParent getJavaClassParent() { + return context; + } }
To unsubscribe from this list please visit:
