Class Utils


  • @Deprecated
    public class Utils
    extends Object
    Deprecated.
    Utilities Class for Doclets.

    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.

    Author:
    Atul M Dambalkar, Jamie Ho
    • Constructor Detail

      • Utils

        public Utils()
        Deprecated.
    • Method Detail

      • excludeDeprecatedMembers

        public ProgramElementDoc[] excludeDeprecatedMembers​(ProgramElementDoc[] members)
        Deprecated.
        Return array of class members whose documentation is to be generated. If the member is deprecated do not include such a member in the returned array.
        Parameters:
        members - Array of members to choose from.
        Returns:
        ProgramElementDoc[] Array of eligible members for whom documentation is getting generated.
      • excludeDeprecatedMembersAsList

        public List<ProgramElementDoc> excludeDeprecatedMembersAsList​(ProgramElementDoc[] members)
        Deprecated.
        Return array of class members whose documentation is to be generated. If the member is deprecated do not include such a member in the returned array.
        Parameters:
        members - Array of members to choose from.
        Returns:
        List List of eligible members for whom documentation is getting generated.
      • nonPublicMemberFound

        public boolean nonPublicMemberFound​(ProgramElementDoc[] members)
        Deprecated.
        Return true if a non-public member found in the given array.
        Parameters:
        members - Array of members to look into.
        Returns:
        boolean True if non-public member found, false otherwise.
      • findMethod

        public MethodDoc findMethod​(ClassDoc cd,
                                    MethodDoc method)
        Deprecated.
        Search for the given method in the given class.
        Parameters:
        cd - Class to search into.
        method - Method to be searched.
        Returns:
        MethodDoc Method found, null otherwise.
      • executableMembersEqual

        public boolean executableMembersEqual​(ExecutableMemberDoc member1,
                                              ExecutableMemberDoc member2)
        Deprecated.
        Parameters:
        member1 - the first method to compare.
        member2 - the second method to compare.
        Returns:
        true if member1 overrides/hides or is overriden/hidden by member2.
      • isCoreClass

        public boolean isCoreClass​(ClassDoc cd)
        Deprecated.
        According to The Java™ Language Specification, all the outer classes and static inner classes are core classes.
      • copyDocFiles

        public void copyDocFiles​(Configuration configuration,
                                 PackageDoc pd)
        Deprecated.
        Copy the given directory contents from the source package directory to the generated documentation directory. For example for a package java.lang this method find out the source location of the package using SourcePath and if given directory is found in the source directory structure, copy the entire directory, to the generated documentation hierarchy.
        Parameters:
        configuration - The configuration of the current doclet.
        path - The relative path to the directory to be copied.
        dir - The original directory name to copy from.
        overwrite - Overwrite files if true.
      • makeTypeComparator

        public Comparator<Type> makeTypeComparator()
        Deprecated.
        Returns a TypeComparator object suitable for sorting Types.
        Returns:
        a TypeComparator objectt
      • getAllInterfaces

        public List<Type> getAllInterfaces​(Type type,
                                           Configuration configuration,
                                           boolean sort)
        Deprecated.
        For the class return all implemented interfaces including the superinterfaces of the implementing interfaces, also iterate over for all the superclasses. For interface return all the extended interfaces as well as superinterfaces for those extended interfaces.
        Parameters:
        type - type whose implemented or super interfaces are sought.
        configuration - the current configuration of the doclet.
        sort - if true, return list of interfaces sorted alphabetically.
        Returns:
        List of all the required interfaces.
      • quote

        public String quote​(String filepath)
        Deprecated.
        Enclose in quotes, used for paths and filenames that contains spaces
      • getPackageName

        public String getPackageName​(PackageDoc packageDoc)
        Deprecated.
        Given a package, return its name.
        Parameters:
        packageDoc - the package to check.
        Returns:
        the name of the given package.
      • getPackageFileHeadName

        public String getPackageFileHeadName​(PackageDoc packageDoc)
        Deprecated.
        Given a package, return its file name without the extension.
        Parameters:
        packageDoc - the package to check.
        Returns:
        the file name of the given package.
      • replaceText

        public String replaceText​(String originalStr,
                                  String oldStr,
                                  String newStr)
        Deprecated.
        Given a string, replace all occurrences of 'newStr' with 'oldStr'.
        Parameters:
        originalStr - the string to modify.
        oldStr - the string to replace.
        newStr - the string to insert in place of the old string.
      • isDocumentedAnnotation

        public boolean isDocumentedAnnotation​(AnnotationTypeDoc annotationDoc)
        Deprecated.
        Given an annotation, return true if it should be documented and false otherwise.
        Parameters:
        annotationDoc - the annotation to check.
        Returns:
        true return true if it should be documented and false otherwise.
      • isDeclarationAnnotation

        public boolean isDeclarationAnnotation​(AnnotationTypeDoc annotationDoc,
                                               boolean isJava5DeclarationLocation)
        Deprecated.
        Returns true if the annotationDoc is to be treated as a declaration annotation, when targeting the elemType element type.
        Parameters:
        annotationDoc - the annotationDoc to check
        elemType - the targeted elemType
        Returns:
        true if annotationDoc is a declaration annotation
      • isLinkable

        public boolean isLinkable​(ClassDoc classDoc,
                                  Configuration configuration)
        Deprecated.
        Return true if this class is linkable and false if we can't link to the desired class.
        NOTE: You can only link to external classes if they are public or protected.
        Parameters:
        classDoc - the class to check.
        configuration - the current configuration of the doclet.
        Returns:
        true if this class is linkable and false if we can't link to the desired class.
      • getFirstVisibleSuperClass

        public Type getFirstVisibleSuperClass​(ClassDoc classDoc,
                                              Configuration configuration)
        Deprecated.
        Given a class, return the closest visible super class.
        Parameters:
        classDoc - the class we are searching the parent for.
        configuration - the current configuration of the doclet.
        Returns:
        the closest visible super class. Return null if it cannot be found (i.e. classDoc is java.lang.Object).
      • getFirstVisibleSuperClassCD

        public ClassDoc getFirstVisibleSuperClassCD​(ClassDoc classDoc,
                                                    Configuration configuration)
        Deprecated.
        Given a class, return the closest visible super class.
        Parameters:
        classDoc - the class we are searching the parent for.
        configuration - the current configuration of the doclet.
        Returns:
        the closest visible super class. Return null if it cannot be found (i.e. classDoc is java.lang.Object).
      • getTypeName

        public String getTypeName​(Configuration config,
                                  ClassDoc cd,
                                  boolean lowerCaseOnly)
        Deprecated.
        Given a ClassDoc, return the name of its type (Class, Interface, etc.).
        Parameters:
        cd - the ClassDoc to check.
        lowerCaseOnly - true if you want the name returned in lower case. If false, the first letter of the name is capitalized.
        Returns:
      • replaceTabs

        public String replaceTabs​(Configuration configuration,
                                  String text)
        Deprecated.
        Replace all tabs in a string with the appropriate number of spaces. The string may be a multi-line string.
        Parameters:
        configuration - the doclet configuration defining the setting for the tab length.
        text - the text for which the tabs should be expanded
        Returns:
        the text with all tabs expanded
      • normalizeNewlines

        public String normalizeNewlines​(String text)
        Deprecated.
      • setEnumDocumentation

        public void setEnumDocumentation​(Configuration configuration,
                                         ClassDoc classDoc)
        Deprecated.
        The documentation for values() and valueOf() in Enums are set by the doclet.
      • isDeprecated

        public boolean isDeprecated​(Doc doc)
        Deprecated.
        Return true if the given Doc is deprecated.
        Parameters:
        doc - the Doc to check.
        Returns:
        true if the given Doc is deprecated.
      • propertyNameFromMethodName

        public String propertyNameFromMethodName​(Configuration configuration,
                                                 String name)
        Deprecated.
        A convenience method to get property name from the name of the getter or setter method.
        Parameters:
        name - name of the getter or setter method.
        Returns:
        the name of the property of the given setter of getter.
      • filterOutPrivateClasses

        public ClassDoc[] filterOutPrivateClasses​(ClassDoc[] classes,
                                                  boolean javafx)
        Deprecated.
        In case of JavaFX mode on, filters out classes that are private, package private or having the @treatAsPrivate annotation. Those are not documented in JavaFX mode.
        Parameters:
        classes - array of classes to be filtered.
        javafx - set to true if in JavaFX mode.
        Returns:
        list of filtered classes.
      • isJava5DeclarationElementType

        public boolean isJava5DeclarationElementType​(FieldDoc elt)
        Deprecated.
        Test whether the given FieldDoc is one of the declaration annotation ElementTypes defined in Java 5. Instead of testing for one of the new enum constants added in Java 8, test for the old constants. This prevents bootstrapping problems.
        Parameters:
        elt - The FieldDoc to test
        Returns:
        true, iff the given ElementType is one of the constants defined in Java 5
        Since:
        1.8
      • compareStrings

        public static int compareStrings​(String s1,
                                         String s2)
        Deprecated.
        A general purpose case insensitive String comparator, which compares two Strings using a Collator strength of "TERTIARY".
        Parameters:
        s1 - first String to compare.
        s2 - second String to compare.
        Returns:
        a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
      • compareCaseCompare

        public static int compareCaseCompare​(String s1,
                                             String s2)
        Deprecated.
        A general purpose case sensitive String comparator, which compares two Strings using a Collator strength of "SECONDARY".
        Parameters:
        s1 - first String to compare.
        s2 - second String to compare.
        Returns:
        a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
      • makeGeneralPurposeComparator

        public Comparator<Doc> makeGeneralPurposeComparator()
        Deprecated.
        A simple comparator which compares simple names, then the fully qualified names and finally the kinds, ClassUse comparator works well for this purpose.
        Returns:
        a simple general purpose doc comparator
      • makeComparatorForIndexUse

        public Comparator<Doc> makeComparatorForIndexUse()
        Deprecated.
        A comparator for index file presentations, and are sorted as follows: 1. sort on simple names of entities 2. if equal, then compare the DocKind ex: Package, Interface etc. 3a. if equal and if the type is of ExecutableMemberDoc(Constructor, Methods), a case insensitive comparison of parameter the type signatures 3b. if equal, case sensitive comparison of the type signatures 4. finally, if equal, compare the FQNs of the entities
        Returns:
        a comparator for index file use
      • makeComparatorForClassUse

        public Comparator<Doc> makeComparatorForClassUse()
        Deprecated.
        Comparator for ClassUse presentations, and sorted as follows, 1. compares simple names of entities 2. if equal, the fully qualified names of the entities 3. if equal and if applicable, the string representation of parameter types 3a. first by using case insensitive comparison 3b. second by using a case sensitive comparison 4. finally the Doc kinds ie. package, class, interface etc.
        Returns:
        a comparator to sort classes and members for class use