1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/share/classes/com/sun/javadoc/ClassDoc.java Sat Dec 01 00:00:00 2007 +0000 1.3 @@ -0,0 +1,340 @@ 1.4 +/* 1.5 + * Copyright 1998-2006 Sun Microsystems, Inc. All Rights Reserved. 1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 + * 1.8 + * This code is free software; you can redistribute it and/or modify it 1.9 + * under the terms of the GNU General Public License version 2 only, as 1.10 + * published by the Free Software Foundation. Sun designates this 1.11 + * particular file as subject to the "Classpath" exception as provided 1.12 + * by Sun in the LICENSE file that accompanied this code. 1.13 + * 1.14 + * This code is distributed in the hope that it will be useful, but WITHOUT 1.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.17 + * version 2 for more details (a copy is included in the LICENSE file that 1.18 + * accompanied this code). 1.19 + * 1.20 + * You should have received a copy of the GNU General Public License version 1.21 + * 2 along with this work; if not, write to the Free Software Foundation, 1.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.23 + * 1.24 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 1.25 + * CA 95054 USA or visit www.sun.com if you need additional information or 1.26 + * have any questions. 1.27 + */ 1.28 + 1.29 +package com.sun.javadoc; 1.30 + 1.31 + 1.32 +/** 1.33 + * Represents a java class or interface and provides access to 1.34 + * information about the class, the class's comment and tags, and the 1.35 + * members of the class. A ClassDoc only exists if it was 1.36 + * processed in this run of javadoc. References to classes 1.37 + * which may or may not have been processed in this run are 1.38 + * referred to using Type (which can be converted to ClassDoc, 1.39 + * if possible). 1.40 + * 1.41 + * @see Type 1.42 + * 1.43 + * @since 1.2 1.44 + * @author Kaiyang Liu (original) 1.45 + * @author Robert Field (rewrite) 1.46 + */ 1.47 +public interface ClassDoc extends ProgramElementDoc, Type { 1.48 + 1.49 + /** 1.50 + * Return true if this class is abstract. Return true 1.51 + * for all interfaces. 1.52 + */ 1.53 + boolean isAbstract(); 1.54 + 1.55 + /** 1.56 + * Return true if this class implements or interface extends 1.57 + * <code>java.io.Serializable</code>. 1.58 + * 1.59 + * Since <code>java.io.Externalizable</code> extends 1.60 + * <code>java.io.Serializable</code>, 1.61 + * Externalizable objects are also Serializable. 1.62 + */ 1.63 + boolean isSerializable(); 1.64 + 1.65 + /** 1.66 + * Return true if this class implements or interface extends 1.67 + * <code>java.io.Externalizable</code>. 1.68 + */ 1.69 + boolean isExternalizable(); 1.70 + 1.71 + /** 1.72 + * Return the serialization methods for this class or 1.73 + * interface. 1.74 + * 1.75 + * @return an array of MethodDoc objects that represents 1.76 + * the serialization methods for this class or interface. 1.77 + */ 1.78 + MethodDoc[] serializationMethods(); 1.79 + 1.80 + /** 1.81 + * Return the Serializable fields of this class or interface. 1.82 + * <p> 1.83 + * Return either a list of default fields documented by 1.84 + * <code>serial</code> tag<br> 1.85 + * or return a single <code>FieldDoc</code> for 1.86 + * <code>serialPersistentField</code> member. 1.87 + * There should be a <code>serialField</code> tag for 1.88 + * each Serializable field defined by an <code>ObjectStreamField</code> 1.89 + * array component of <code>serialPersistentField</code>. 1.90 + * 1.91 + * @return an array of <code>FieldDoc</code> objects for the Serializable 1.92 + * fields of this class or interface. 1.93 + * 1.94 + * @see #definesSerializableFields() 1.95 + * @see SerialFieldTag 1.96 + */ 1.97 + FieldDoc[] serializableFields(); 1.98 + 1.99 + /** 1.100 + * Return true if Serializable fields are explicitly defined with 1.101 + * the special class member <code>serialPersistentFields</code>. 1.102 + * 1.103 + * @see #serializableFields() 1.104 + * @see SerialFieldTag 1.105 + */ 1.106 + boolean definesSerializableFields(); 1.107 + 1.108 + /** 1.109 + * Return the superclass of this class. Return null if this is an 1.110 + * interface. 1.111 + * 1.112 + * <p> <i>This method cannot accommodate certain generic type constructs. 1.113 + * The <code>superclassType</code> method should be used instead.</i> 1.114 + * 1.115 + * @return the ClassDoc for the superclass of this class, null if 1.116 + * there is no superclass. 1.117 + * @see #superclassType 1.118 + */ 1.119 + ClassDoc superclass(); 1.120 + 1.121 + /** 1.122 + * Return the superclass of this class. Return null if this is an 1.123 + * interface. A superclass is represented by either a 1.124 + * <code>ClassDoc</code> or a <code>ParametrizedType</code>. 1.125 + * 1.126 + * @return the superclass of this class, or null if there is no superclass. 1.127 + * @since 1.5 1.128 + */ 1.129 + Type superclassType(); 1.130 + 1.131 + /** 1.132 + * Test whether this class is a subclass of the specified class. 1.133 + * If this is an interface, return false for all classes except 1.134 + * <code>java.lang.Object</code> (we must keep this unexpected 1.135 + * behavior for compatibility reasons). 1.136 + * 1.137 + * @param cd the candidate superclass. 1.138 + * @return true if cd is a superclass of this class. 1.139 + */ 1.140 + boolean subclassOf(ClassDoc cd); 1.141 + 1.142 + /** 1.143 + * Return interfaces implemented by this class or interfaces extended 1.144 + * by this interface. Includes only directly-declared interfaces, not 1.145 + * inherited interfaces. 1.146 + * Return an empty array if there are no interfaces. 1.147 + * 1.148 + * <p> <i>This method cannot accommodate certain generic type constructs. 1.149 + * The <code>interfaceTypes</code> method should be used instead.</i> 1.150 + * 1.151 + * @return an array of ClassDoc objects representing the interfaces. 1.152 + * @see #interfaceTypes 1.153 + */ 1.154 + ClassDoc[] interfaces(); 1.155 + 1.156 + /** 1.157 + * Return interfaces implemented by this class or interfaces extended 1.158 + * by this interface. Includes only directly-declared interfaces, not 1.159 + * inherited interfaces. 1.160 + * Return an empty array if there are no interfaces. 1.161 + * 1.162 + * @return an array of interfaces, each represented by a 1.163 + * <code>ClassDoc</code> or a <code>ParametrizedType</code>. 1.164 + * @since 1.5 1.165 + */ 1.166 + Type[] interfaceTypes(); 1.167 + 1.168 + /** 1.169 + * Return the formal type parameters of this class or interface. 1.170 + * Return an empty array if there are none. 1.171 + * 1.172 + * @return the formal type parameters of this class or interface. 1.173 + * @since 1.5 1.174 + */ 1.175 + TypeVariable[] typeParameters(); 1.176 + 1.177 + /** 1.178 + * Return the type parameter tags of this class or interface. 1.179 + * Return an empty array if there are none. 1.180 + * 1.181 + * @return the type parameter tags of this class or interface. 1.182 + * @since 1.5 1.183 + */ 1.184 + ParamTag[] typeParamTags(); 1.185 + 1.186 + /** 1.187 + * Return 1.188 + * <a href="{@docRoot}/com/sun/javadoc/package-summary.html#included">included</a> 1.189 + * fields in this class or interface. 1.190 + * Excludes enum constants if this is an enum type. 1.191 + * 1.192 + * @return an array of FieldDoc objects representing the included 1.193 + * fields in this class or interface. 1.194 + */ 1.195 + FieldDoc[] fields(); 1.196 + 1.197 + /** 1.198 + * Return fields in this class or interface, filtered to the specified 1.199 + * <a href="{@docRoot}/com/sun/javadoc/package-summary.html#included">access 1.200 + * modifier option</a>. 1.201 + * Excludes enum constants if this is an enum type. 1.202 + * 1.203 + * @param filter Specify true to filter according to the specified access 1.204 + * modifier option. 1.205 + * Specify false to include all fields regardless of 1.206 + * access modifier option. 1.207 + * @return an array of FieldDoc objects representing the included 1.208 + * fields in this class or interface. 1.209 + */ 1.210 + FieldDoc[] fields(boolean filter); 1.211 + 1.212 + /** 1.213 + * Return the enum constants if this is an enum type. 1.214 + * Return an empty array if there are no enum constants, or if 1.215 + * this is not an enum type. 1.216 + * 1.217 + * @return the enum constants if this is an enum type. 1.218 + */ 1.219 + FieldDoc[] enumConstants(); 1.220 + 1.221 + /** 1.222 + * Return 1.223 + * <a href="{@docRoot}/com/sun/javadoc/package-summary.html#included">included</a> 1.224 + * methods in this class or interface. 1.225 + * Same as <code>methods(true)</code>. 1.226 + * 1.227 + * @return an array of MethodDoc objects representing the included 1.228 + * methods in this class or interface. Does not include 1.229 + * constructors or annotation type elements. 1.230 + */ 1.231 + MethodDoc[] methods(); 1.232 + 1.233 + /** 1.234 + * Return methods in this class or interface, filtered to the specified 1.235 + * <a href="{@docRoot}/com/sun/javadoc/package-summary.html#included">access 1.236 + * modifier option</a>. Does not include constructors or annotation 1.237 + * type elements. 1.238 + * 1.239 + * @param filter Specify true to filter according to the specified access 1.240 + * modifier option. 1.241 + * Specify false to include all methods regardless of 1.242 + * access modifier option. 1.243 + * @return an array of MethodDoc objects representing the included 1.244 + * methods in this class or interface. 1.245 + */ 1.246 + MethodDoc[] methods(boolean filter); 1.247 + 1.248 + /** 1.249 + * Return 1.250 + * <a href="{@docRoot}/com/sun/javadoc/package-summary.html#included">included</a> 1.251 + * constructors in this class. An array containing the default 1.252 + * no-arg constructor is returned if no other constructors exist. 1.253 + * Return empty array if this is an interface. 1.254 + * 1.255 + * @return an array of ConstructorDoc objects representing the included 1.256 + * constructors in this class. 1.257 + */ 1.258 + ConstructorDoc[] constructors(); 1.259 + 1.260 + /** 1.261 + * Return constructors in this class, filtered to the specified 1.262 + * <a href="{@docRoot}/com/sun/javadoc/package-summary.html#included">access 1.263 + * modifier option</a>. Return an array containing the default 1.264 + * no-arg constructor if no other constructors exist. 1.265 + * 1.266 + * @param filter Specify true to filter according to the specified access 1.267 + * modifier option. 1.268 + * Specify false to include all constructors regardless of 1.269 + * access modifier option. 1.270 + * @return an array of ConstructorDoc objects representing the included 1.271 + * constructors in this class. 1.272 + */ 1.273 + ConstructorDoc[] constructors(boolean filter); 1.274 + 1.275 + 1.276 + /** 1.277 + * Return 1.278 + * <a href="{@docRoot}/com/sun/javadoc/package-summary.html#included">included</a> 1.279 + * nested classes and interfaces within this class or interface. 1.280 + * This includes both static and non-static nested classes. 1.281 + * (This method should have been named <code>nestedClasses()</code>, 1.282 + * as inner classes are technically non-static.) Anonymous and local classes 1.283 + * or interfaces are not included. 1.284 + * 1.285 + * @return an array of ClassDoc objects representing the included classes 1.286 + * and interfaces defined in this class or interface. 1.287 + */ 1.288 + ClassDoc[] innerClasses(); 1.289 + 1.290 + /** 1.291 + * Return nested classes and interfaces within this class or interface 1.292 + * filtered to the specified 1.293 + * <a href="{@docRoot}/com/sun/javadoc/package-summary.html#included">access 1.294 + * modifier option</a>. 1.295 + * This includes both static and non-static nested classes. 1.296 + * Anonymous and local classes are not included. 1.297 + * 1.298 + * @param filter Specify true to filter according to the specified access 1.299 + * modifier option. 1.300 + * Specify false to include all nested classes regardless of 1.301 + * access modifier option. 1.302 + * @return a filtered array of ClassDoc objects representing the included 1.303 + * classes and interfaces defined in this class or interface. 1.304 + */ 1.305 + ClassDoc[] innerClasses(boolean filter); 1.306 + 1.307 + /** 1.308 + * Find the specified class or interface within the context of this class doc. 1.309 + * Search order: 1) qualified name, 2) nested in this class or interface, 1.310 + * 3) in this package, 4) in the class imports, 5) in the package imports. 1.311 + * Return the ClassDoc if found, null if not found. 1.312 + */ 1.313 + ClassDoc findClass(String className); 1.314 + 1.315 + /** 1.316 + * Get the list of classes and interfaces declared as imported. 1.317 + * These are called "single-type-import declarations" in the 1.318 + * Java Language Specification. 1.319 + * 1.320 + * @return an array of ClassDoc representing the imported classes. 1.321 + * 1.322 + * @deprecated Import declarations are implementation details that 1.323 + * should not be exposed here. In addition, not all imported 1.324 + * classes are imported through single-type-import declarations. 1.325 + */ 1.326 + @Deprecated 1.327 + ClassDoc[] importedClasses(); 1.328 + 1.329 + /** 1.330 + * Get the list of packages declared as imported. 1.331 + * These are called "type-import-on-demand declarations" in the 1.332 + * Java Language Specification. 1.333 + * 1.334 + * @return an array of PackageDoc representing the imported packages. 1.335 + * 1.336 + * @deprecated Import declarations are implementation details that 1.337 + * should not be exposed here. In addition, this method's 1.338 + * return type does not allow for all type-import-on-demand 1.339 + * declarations to be returned. 1.340 + */ 1.341 + @Deprecated 1.342 + PackageDoc[] importedPackages(); 1.343 +}