Path: blob/aarch64-shenandoah-jdk8u272-b10/langtools/src/share/classes/com/sun/javadoc/ClassDoc.java
38890 views
/*1* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package com.sun.javadoc;262728/**29* Represents a java class or interface and provides access to30* information about the class, the class's comment and tags, and the31* members of the class. A ClassDoc only exists if it was32* processed in this run of javadoc. References to classes33* which may or may not have been processed in this run are34* referred to using Type (which can be converted to ClassDoc,35* if possible).36*37* @see Type38*39* @since 1.240* @author Kaiyang Liu (original)41* @author Robert Field (rewrite)42*/43public interface ClassDoc extends ProgramElementDoc, Type {4445/**46* Return true if this class is abstract. Return true47* for all interfaces.48*/49boolean isAbstract();5051/**52* Return true if this class implements or interface extends53* <code>java.io.Serializable</code>.54*55* Since <code>java.io.Externalizable</code> extends56* <code>java.io.Serializable</code>,57* Externalizable objects are also Serializable.58*/59boolean isSerializable();6061/**62* Return true if this class implements or interface extends63* <code>java.io.Externalizable</code>.64*/65boolean isExternalizable();6667/**68* Return the serialization methods for this class or69* interface.70*71* @return an array of MethodDoc objects that represents72* the serialization methods for this class or interface.73*/74MethodDoc[] serializationMethods();7576/**77* Return the Serializable fields of this class or interface.78* <p>79* Return either a list of default fields documented by80* <code>serial</code> tag<br>81* or return a single <code>FieldDoc</code> for82* <code>serialPersistentField</code> member.83* There should be a <code>serialField</code> tag for84* each Serializable field defined by an <code>ObjectStreamField</code>85* array component of <code>serialPersistentField</code>.86*87* @return an array of <code>FieldDoc</code> objects for the Serializable88* fields of this class or interface.89*90* @see #definesSerializableFields()91* @see SerialFieldTag92*/93FieldDoc[] serializableFields();9495/**96* Return true if Serializable fields are explicitly defined with97* the special class member <code>serialPersistentFields</code>.98*99* @see #serializableFields()100* @see SerialFieldTag101*/102boolean definesSerializableFields();103104/**105* Return the superclass of this class. Return null if this is an106* interface.107*108* <p> <i>This method cannot accommodate certain generic type constructs.109* The <code>superclassType</code> method should be used instead.</i>110*111* @return the ClassDoc for the superclass of this class, null if112* there is no superclass.113* @see #superclassType114*/115ClassDoc superclass();116117/**118* Return the superclass of this class. Return null if this is an119* interface. A superclass is represented by either a120* <code>ClassDoc</code> or a <code>ParametrizedType</code>.121*122* @return the superclass of this class, or null if there is no superclass.123* @since 1.5124*/125Type superclassType();126127/**128* Test whether this class is a subclass of the specified class.129* If this is an interface, return false for all classes except130* <code>java.lang.Object</code> (we must keep this unexpected131* behavior for compatibility reasons).132*133* @param cd the candidate superclass.134* @return true if cd is a superclass of this class.135*/136boolean subclassOf(ClassDoc cd);137138/**139* Return interfaces implemented by this class or interfaces extended140* by this interface. Includes only directly-declared interfaces, not141* inherited interfaces.142* Return an empty array if there are no interfaces.143*144* <p> <i>This method cannot accommodate certain generic type constructs.145* The <code>interfaceTypes</code> method should be used instead.</i>146*147* @return an array of ClassDoc objects representing the interfaces.148* @see #interfaceTypes149*/150ClassDoc[] interfaces();151152/**153* Return interfaces implemented by this class or interfaces extended154* by this interface. Includes only directly-declared interfaces, not155* inherited interfaces.156* Return an empty array if there are no interfaces.157*158* @return an array of interfaces, each represented by a159* <code>ClassDoc</code> or a <code>ParametrizedType</code>.160* @since 1.5161*/162Type[] interfaceTypes();163164/**165* Return the formal type parameters of this class or interface.166* Return an empty array if there are none.167*168* @return the formal type parameters of this class or interface.169* @since 1.5170*/171TypeVariable[] typeParameters();172173/**174* Return the type parameter tags of this class or interface.175* Return an empty array if there are none.176*177* @return the type parameter tags of this class or interface.178* @since 1.5179*/180ParamTag[] typeParamTags();181182/**183* Return184* <a href="{@docRoot}/com/sun/javadoc/package-summary.html#included">included</a>185* fields in this class or interface.186* Excludes enum constants if this is an enum type.187*188* @return an array of FieldDoc objects representing the included189* fields in this class or interface.190*/191FieldDoc[] fields();192193/**194* Return fields in this class or interface, filtered to the specified195* <a href="{@docRoot}/com/sun/javadoc/package-summary.html#included">access196* modifier option</a>.197* Excludes enum constants if this is an enum type.198*199* @param filter Specify true to filter according to the specified access200* modifier option.201* Specify false to include all fields regardless of202* access modifier option.203* @return an array of FieldDoc objects representing the included204* fields in this class or interface.205*/206FieldDoc[] fields(boolean filter);207208/**209* Return the enum constants if this is an enum type.210* Return an empty array if there are no enum constants, or if211* this is not an enum type.212*213* @return the enum constants if this is an enum type.214*/215FieldDoc[] enumConstants();216217/**218* Return219* <a href="{@docRoot}/com/sun/javadoc/package-summary.html#included">included</a>220* methods in this class or interface.221* Same as <code>methods(true)</code>.222*223* @return an array of MethodDoc objects representing the included224* methods in this class or interface. Does not include225* constructors or annotation type elements.226*/227MethodDoc[] methods();228229/**230* Return methods in this class or interface, filtered to the specified231* <a href="{@docRoot}/com/sun/javadoc/package-summary.html#included">access232* modifier option</a>. Does not include constructors or annotation233* type elements.234*235* @param filter Specify true to filter according to the specified access236* modifier option.237* Specify false to include all methods regardless of238* access modifier option.239* @return an array of MethodDoc objects representing the included240* methods in this class or interface.241*/242MethodDoc[] methods(boolean filter);243244/**245* Return246* <a href="{@docRoot}/com/sun/javadoc/package-summary.html#included">included</a>247* constructors in this class. An array containing the default248* no-arg constructor is returned if no other constructors exist.249* Return empty array if this is an interface.250*251* @return an array of ConstructorDoc objects representing the included252* constructors in this class.253*/254ConstructorDoc[] constructors();255256/**257* Return constructors in this class, filtered to the specified258* <a href="{@docRoot}/com/sun/javadoc/package-summary.html#included">access259* modifier option</a>. Return an array containing the default260* no-arg constructor if no other constructors exist.261*262* @param filter Specify true to filter according to the specified access263* modifier option.264* Specify false to include all constructors regardless of265* access modifier option.266* @return an array of ConstructorDoc objects representing the included267* constructors in this class.268*/269ConstructorDoc[] constructors(boolean filter);270271272/**273* Return274* <a href="{@docRoot}/com/sun/javadoc/package-summary.html#included">included</a>275* nested classes and interfaces within this class or interface.276* This includes both static and non-static nested classes.277* (This method should have been named <code>nestedClasses()</code>,278* as inner classes are technically non-static.) Anonymous and local classes279* or interfaces are not included.280*281* @return an array of ClassDoc objects representing the included classes282* and interfaces defined in this class or interface.283*/284ClassDoc[] innerClasses();285286/**287* Return nested classes and interfaces within this class or interface288* filtered to the specified289* <a href="{@docRoot}/com/sun/javadoc/package-summary.html#included">access290* modifier option</a>.291* This includes both static and non-static nested classes.292* Anonymous and local classes are not included.293*294* @param filter Specify true to filter according to the specified access295* modifier option.296* Specify false to include all nested classes regardless of297* access modifier option.298* @return a filtered array of ClassDoc objects representing the included299* classes and interfaces defined in this class or interface.300*/301ClassDoc[] innerClasses(boolean filter);302303/**304* Find the specified class or interface within the context of this class doc.305* Search order: 1) qualified name, 2) nested in this class or interface,306* 3) in this package, 4) in the class imports, 5) in the package imports.307* Return the ClassDoc if found, null if not found.308*/309ClassDoc findClass(String className);310311/**312* Get the list of classes and interfaces declared as imported.313* These are called "single-type-import declarations" in314* <cite>The Java™ Language Specification</cite>.315*316* @return an array of ClassDoc representing the imported classes.317*318* @deprecated Import declarations are implementation details that319* should not be exposed here. In addition, not all imported320* classes are imported through single-type-import declarations.321*/322@Deprecated323ClassDoc[] importedClasses();324325/**326* Get the list of packages declared as imported.327* These are called "type-import-on-demand declarations" in328* <cite>The Java™ Language Specification</cite>.329*330* @return an array of PackageDoc representing the imported packages.331*332* @deprecated Import declarations are implementation details that333* should not be exposed here. In addition, this method's334* return type does not allow for all type-import-on-demand335* declarations to be returned.336*/337@Deprecated338PackageDoc[] importedPackages();339}340341342