Class ClassDocImpl

  • All Implemented Interfaces:
    ClassDoc, Doc, ProgramElementDoc, Type, Comparable<Object>
    Direct Known Subclasses:
    AnnotationTypeDocImpl

    @Deprecated
    public class ClassDocImpl
    extends ProgramElementDocImpl
    implements ClassDoc
    Deprecated.
    Represents a java class and provides access to information about the class, the class' comment and tags, and the members of the class. A ClassDocImpl only exists if it was processed in this run of javadoc. References to classes which may or may not have been processed in this run are referred to using Type (which can be converted to ClassDocImpl, if possible).

    This is NOT part of any supported API. If you write code that depends on this, you do so at your own risk. This code and its internal interfaces are subject to change or deletion without notice.

    Since:
    1.2
    Author:
    Robert Field, Neal Gafter (rewrite), Scott Seligman (generics, enums, annotations)
    See Also:
    Type
    • Field Detail

      • type

        public final com.sun.tools.javac.code.Type.ClassType type
        Deprecated.
      • tsym

        public final com.sun.tools.javac.code.Symbol.ClassSymbol tsym
        Deprecated.
    • Constructor Detail

      • ClassDocImpl

        public ClassDocImpl​(DocEnv env,
                            com.sun.tools.javac.code.Symbol.ClassSymbol sym)
        Deprecated.
        Constructor
      • ClassDocImpl

        public ClassDocImpl​(DocEnv env,
                            com.sun.tools.javac.code.Symbol.ClassSymbol sym,
                            com.sun.source.util.TreePath treePath)
        Deprecated.
        Constructor
    • Method Detail

      • getElementType

        public Type getElementType()
        Deprecated.
        Description copied from interface: Type
        If this type is an array type, return the element type of the array. Otherwise, return null.
        Specified by:
        getElementType in interface Type
        Returns:
        a Type representing the element type or null.
      • getFlags

        protected long getFlags()
        Deprecated.
        Returns the flags in terms of javac's flags
        Specified by:
        getFlags in class ProgramElementDocImpl
      • getContainingClass

        protected com.sun.tools.javac.code.Symbol.ClassSymbol getContainingClass()
        Deprecated.
        Identify the containing class
        Specified by:
        getContainingClass in class ProgramElementDocImpl
      • isClass

        public boolean isClass()
        Deprecated.
        Return true if this is a class, not an interface.
        Specified by:
        isClass in interface Doc
        Overrides:
        isClass in class DocImpl
        Returns:
        true if it represents a class
      • isOrdinaryClass

        public boolean isOrdinaryClass()
        Deprecated.
        Return true if this is a ordinary class, not an enumeration, exception, an error, or an interface.
        Specified by:
        isOrdinaryClass in interface Doc
        Overrides:
        isOrdinaryClass in class DocImpl
        Returns:
        true if it represents an ordinary class
      • isEnum

        public boolean isEnum()
        Deprecated.
        Return true if this is an enumeration. (For legacy doclets, return false.)
        Specified by:
        isEnum in interface Doc
        Overrides:
        isEnum in class DocImpl
        Returns:
        true if it represents an enum type
      • isInterface

        public boolean isInterface()
        Deprecated.
        Return true if this is an interface, but not an annotation type. Overridden by AnnotationTypeDocImpl.
        Specified by:
        isInterface in interface Doc
        Overrides:
        isInterface in class DocImpl
        Returns:
        true if it represents a interface
      • isException

        public boolean isException()
        Deprecated.
        Return true if this is an exception class
        Specified by:
        isException in interface Doc
        Overrides:
        isException in class DocImpl
        Returns:
        true if it represents a exception
      • isError

        public boolean isError()
        Deprecated.
        Return true if this is an error class
        Specified by:
        isError in interface Doc
        Overrides:
        isError in class DocImpl
        Returns:
        true if it represents a error
      • isThrowable

        public boolean isThrowable()
        Deprecated.
        Return true if this is a throwable class
      • isAbstract

        public boolean isAbstract()
        Deprecated.
        Return true if this class is abstract
        Specified by:
        isAbstract in interface ClassDoc
        Returns:
        true if this class is abstract. Return true for all interfaces.
      • isSynthetic

        public boolean isSynthetic()
        Deprecated.
        Returns true if this class was synthesized by the compiler.
      • isIncluded

        public boolean isIncluded()
        Deprecated.
        Return true if this class is included in the active set. A ClassDoc is included iff either it is specified on the commandline, or if it's containing package is specified on the command line, or if it is a member class of an included class.
        Specified by:
        isIncluded in interface Doc
        Specified by:
        isIncluded in class DocImpl
        Returns:
        true if this Doc item is included in the result set.
      • name

        public String name()
        Deprecated.
        Return the class name without package qualifier - but with enclosing class qualifier - as a String.
         Examples:
          for java.util.Hashtable
          return Hashtable
          for java.util.Map.Entry
          return Map.Entry
         
        Specified by:
        name in interface Doc
        Specified by:
        name in class DocImpl
        Returns:
        the name
      • qualifiedName

        public String qualifiedName()
        Deprecated.
        Return the qualified class name as a String.
         Example:
          for java.util.Hashtable
          return java.util.Hashtable
          if no qualifier, just return flat name
         
        Specified by:
        qualifiedName in interface ProgramElementDoc
        Specified by:
        qualifiedName in class DocImpl
        Returns:
        the name
      • typeName

        public String typeName()
        Deprecated.
        Return unqualified name of type excluding any dimension information.

        For example, a two dimensional array of String returns 'String'.

        Specified by:
        typeName in interface Type
        Returns:
        unqualified name of type excluding any dimension information.
      • qualifiedTypeName

        public String qualifiedTypeName()
        Deprecated.
        Return qualified name of type excluding any dimension information.

        For example, a two dimensional array of String returns 'java.lang.String'.

        Specified by:
        qualifiedTypeName in interface Type
        Returns:
        qualified name of this type excluding any dimension information.
      • simpleTypeName

        public String simpleTypeName()
        Deprecated.
        Return the simple name of this type.
        Specified by:
        simpleTypeName in interface Type
        Returns:
        the simple name of this type excluding any dimension information.
      • toString

        public String toString()
        Deprecated.
        Return the qualified name and any type parameters. Each parameter is a type variable with optional bounds.
        Specified by:
        toString in interface Type
        Overrides:
        toString in class DocImpl
        Returns:
        a string representation of the type.
      • typeParameters

        public TypeVariable[] typeParameters()
        Deprecated.
        Return the formal type parameters of this class or interface. Return an empty array if there are none.
        Specified by:
        typeParameters in interface ClassDoc
        Returns:
        the formal type parameters of this class or interface.
      • typeParamTags

        public ParamTag[] typeParamTags()
        Deprecated.
        Return the type parameter tags of this class or interface.
        Specified by:
        typeParamTags in interface ClassDoc
        Returns:
        the type parameter tags of this class or interface.
      • superclass

        public ClassDoc superclass()
        Deprecated.
        Return the superclass of this class
        Specified by:
        superclass in interface ClassDoc
        Returns:
        the ClassDocImpl for the superclass of this class, null if there is no superclass.
        See Also:
        ClassDoc.superclassType()
      • superclassType

        public Type superclassType()
        Deprecated.
        Return the superclass of this class. Return null if this is an interface. A superclass is represented by either a ClassDoc or a ParameterizedType.
        Specified by:
        superclassType in interface ClassDoc
        Returns:
        the superclass of this class, or null if there is no superclass.
      • subclassOf

        public boolean subclassOf​(ClassDoc cd)
        Deprecated.
        Test whether this class is a subclass of the specified class.
        Specified by:
        subclassOf in interface ClassDoc
        Parameters:
        cd - the candidate superclass.
        Returns:
        true if cd is a superclass of this class.
      • interfaces

        public ClassDoc[] interfaces()
        Deprecated.
        Return interfaces implemented by this class or interfaces extended by this interface.
        Specified by:
        interfaces in interface ClassDoc
        Returns:
        An array of ClassDocImpl representing the interfaces. Return an empty array if there are no interfaces.
        See Also:
        ClassDoc.interfaceTypes()
      • interfaceTypes

        public Type[] interfaceTypes()
        Deprecated.
        Return interfaces implemented by this class or interfaces extended by this interface. Includes only directly-declared interfaces, not inherited interfaces. Return an empty array if there are no interfaces.
        Specified by:
        interfaceTypes in interface ClassDoc
        Returns:
        an array of interfaces, each represented by a ClassDoc or a ParametrizedType.
      • fields

        public FieldDoc[] fields​(boolean filter)
        Deprecated.
        Return fields in class.
        Specified by:
        fields in interface ClassDoc
        Parameters:
        filter - include only the included fields if filter==true
        Returns:
        an array of FieldDoc objects representing the included fields in this class or interface.
      • fields

        public FieldDoc[] fields()
        Deprecated.
        Return included fields in class.
        Specified by:
        fields in interface ClassDoc
        Returns:
        an array of FieldDoc objects representing the included fields in this class or interface.
      • enumConstants

        public FieldDoc[] enumConstants()
        Deprecated.
        Return the enum constants if this is an enum type.
        Specified by:
        enumConstants in interface ClassDoc
        Returns:
        the enum constants if this is an enum type.
      • methods

        public MethodDoc[] methods​(boolean filter)
        Deprecated.
        Return methods in class. This method is overridden by AnnotationTypeDocImpl.
        Specified by:
        methods in interface ClassDoc
        Parameters:
        filter - include only the included methods if filter==true
        Returns:
        an array of MethodDocImpl for representing the visible methods in this class. Does not include constructors.
      • methods

        public MethodDoc[] methods()
        Deprecated.
        Return included methods in class.
        Specified by:
        methods in interface ClassDoc
        Returns:
        an array of MethodDocImpl for representing the visible methods in this class. Does not include constructors.
      • constructors

        public ConstructorDoc[] constructors​(boolean filter)
        Deprecated.
        Return constructors in class.
        Specified by:
        constructors in interface ClassDoc
        Parameters:
        filter - include only the included constructors if filter==true
        Returns:
        an array of ConstructorDocImpl for representing the visible constructors in this class.
      • constructors

        public ConstructorDoc[] constructors()
        Deprecated.
        Return included constructors in class.
        Specified by:
        constructors in interface ClassDoc
        Returns:
        an array of ConstructorDocImpl for representing the visible constructors in this class.
      • innerClasses

        public ClassDoc[] innerClasses​(boolean filter)
        Deprecated.
        Return inner classes within this class.
        Specified by:
        innerClasses in interface ClassDoc
        Parameters:
        filter - include only the included inner classes if filter==true.
        Returns:
        an array of ClassDocImpl for representing the visible classes defined in this class. Anonymous and local classes are not included.
      • innerClasses

        public ClassDoc[] innerClasses()
        Deprecated.
        Return included inner classes within this class.
        Specified by:
        innerClasses in interface ClassDoc
        Returns:
        an array of ClassDocImpl for representing the visible classes defined in this class. Anonymous and local classes are not included.
      • findClass

        public ClassDoc findClass​(String className)
        Deprecated.
        Find a class within the context of this class. Search order: qualified name, in this class (inner), in this package, in the class imports, in the package imports. Return the ClassDocImpl if found, null if not found.
        Specified by:
        findClass in interface ClassDoc
        Parameters:
        className - Specify the class name to find as a String.
        Returns:
        the ClassDoc if found, null if not found.
      • findMethod

        public MethodDocImpl findMethod​(String methodName,
                                        String[] paramTypes)
        Deprecated.
        Find a method in this class scope. Search order: this class, interfaces, superclasses, outerclasses. Note that this is not necessarily what the compiler would do!
        Parameters:
        methodName - the unqualified name to search for.
        paramTypes - the array of Strings for method parameter types.
        Returns:
        the first MethodDocImpl which matches, null if not found.
      • findConstructor

        public ConstructorDoc findConstructor​(String constrName,
                                              String[] paramTypes)
        Deprecated.
        Find constructor in this class.
        Parameters:
        constrName - the unqualified name to search for.
        paramTypes - the array of Strings for constructor parameters.
        Returns:
        the first ConstructorDocImpl which matches, null if not found.
      • findField

        public FieldDoc findField​(String fieldName)
        Deprecated.
        Find a field in this class scope. Search order: this class, outerclasses, interfaces, superclasses. IMP: If see tag is defined in an inner class, which extends a super class and if outerclass and the super class have a visible field in common then Java compiler cribs about the ambiguity, but the following code will search in the above given search order.
        Parameters:
        fieldName - the unqualified name to search for.
        Returns:
        the first FieldDocImpl which matches, null if not found.
      • importedClasses

        @Deprecated
        public ClassDoc[] importedClasses()
        Deprecated.
        Import declarations are implementation details that should not be exposed here. In addition, not all imported classes are imported through single-type-import declarations.
        Get the list of classes declared as imported. These are called "single-type-import declarations" in the JLS. This method is deprecated in the ClassDoc interface.
        Specified by:
        importedClasses in interface ClassDoc
        Returns:
        an array of ClassDocImpl representing the imported classes.
      • importedPackages

        @Deprecated
        public PackageDoc[] importedPackages()
        Deprecated.
        Import declarations are implementation details that should not be exposed here. In addition, this method's return type does not allow for all type-import-on-demand declarations to be returned.
        Get the list of packages declared as imported. These are called "type-import-on-demand declarations" in the JLS. This method is deprecated in the ClassDoc interface.
        Specified by:
        importedPackages in interface ClassDoc
        Returns:
        an array of PackageDocImpl representing the imported packages. ###NOTE: the syntax supports importing all inner classes from a class as well.
      • dimension

        public String dimension()
        Deprecated.
        Return the type's dimension information. Always return "", as this is not an array type.
        Specified by:
        dimension in interface Type
        Returns:
        the type's dimension information as a string.
      • asClassDoc

        public ClassDoc asClassDoc()
        Deprecated.
        Return this type as a class, which it already is.
        Specified by:
        asClassDoc in interface Type
        Returns:
        the ClassDoc of this type, or null if it is a primitive type.
      • asAnnotationTypeDoc

        public AnnotationTypeDoc asAnnotationTypeDoc()
        Deprecated.
        Return null (unless overridden), as this is not an annotation type.
        Specified by:
        asAnnotationTypeDoc in interface Type
        Returns:
        an AnnotationTypeDoc if the type is an annotation type, or null if it is not.
      • asParameterizedType

        public ParameterizedType asParameterizedType()
        Deprecated.
        Return null, as this is not a class instantiation.
        Specified by:
        asParameterizedType in interface Type
        Returns:
        a ParameterizedType if the type is an invocation of a generic type, or null if it is not.
      • asTypeVariable

        public TypeVariable asTypeVariable()
        Deprecated.
        Return null, as this is not a type variable.
        Specified by:
        asTypeVariable in interface Type
        Returns:
        a TypeVariable if the type is a type variable, or null if it is not.
      • asWildcardType

        public WildcardType asWildcardType()
        Deprecated.
        Return null, as this is not a wildcard type.
        Specified by:
        asWildcardType in interface Type
        Returns:
        a WildcardType if the type is a wildcard type, or null if it is not.
      • asAnnotatedType

        public AnnotatedType asAnnotatedType()
        Deprecated.
        Returns null, as this is not an annotated type.
        Specified by:
        asAnnotatedType in interface Type
        Returns:
        a AnnotatedType if the type if an annotated type, or null if it is not
      • isPrimitive

        public boolean isPrimitive()
        Deprecated.
        Return false, as this is not a primitive type.
        Specified by:
        isPrimitive in interface Type
        Returns:
        true if this type represents a primitive type.
      • isSerializable

        public boolean isSerializable()
        Deprecated.
        Return true if this class implements java.io.Serializable. Since java.io.Externalizable extends java.io.Serializable, Externalizable objects are also Serializable.
        Specified by:
        isSerializable in interface ClassDoc
        Returns:
        true if this class implements or interface extends java.io.Serializable.
      • isExternalizable

        public boolean isExternalizable()
        Deprecated.
        Return true if this class implements java.io.Externalizable.
        Specified by:
        isExternalizable in interface ClassDoc
        Returns:
        true if this class implements or interface extends java.io.Externalizable.
      • serializationMethods

        public MethodDoc[] serializationMethods()
        Deprecated.
        Return the serialization methods for this class.
        Specified by:
        serializationMethods in interface ClassDoc
        Returns:
        an array of MethodDocImpl that represents the serialization methods for this class.
      • serializableFields

        public FieldDoc[] serializableFields()
        Deprecated.
        Return the Serializable fields of class.

        Return either a list of default fields documented by serial tag
        or return a single FieldDoc for serialPersistentField member. There should be a serialField tag for each Serializable field defined by an ObjectStreamField array component of serialPersistentField.

        Specified by:
        serializableFields in interface ClassDoc
        Returns:
        an array of FieldDoc for the Serializable fields of this class.
        See Also:
        definesSerializableFields(), SerialFieldTagImpl
      • definesSerializableFields

        public boolean definesSerializableFields()
        Deprecated.
        Return true if Serializable fields are explicitly defined with the special class member serialPersistentFields.
        Specified by:
        definesSerializableFields in interface ClassDoc
        Returns:
        true if Serializable fields are explicitly defined with the special class member serialPersistentFields.
        See Also:
        serializableFields(), SerialFieldTagImpl
      • position

        public SourcePosition position()
        Deprecated.
        Return the source position of the entity, or null if no position is available.
        Specified by:
        position in interface Doc
        Overrides:
        position in class DocImpl
        Returns:
        the source positino of the first line of the corresponding declaration, or null if no position is available. A default constructor returns null because it has no location in the source file.