Util.java revision 116
116N/A * Copyright 1999-2008 Sun Microsystems, Inc. All Rights Reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 0N/A * published by the Free Software Foundation. Sun designates this 0N/A * particular file as subject to the "Classpath" exception as provided 0N/A * by Sun in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 0N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 0N/A * CA 95054 USA or visit www.sun.com if you need additional information or 0N/A * have any questions. 0N/A * Utilities Class for Doclets. 0N/A * This code is not part of an API. 0N/A * It is implementation that is subject to change. 0N/A * Do not use it as an API 0N/A * @author Atul M Dambalkar 0N/A * A mapping between characters and their 0N/A * corresponding HTML escape character. 0N/A {{
"&",
"&"}, {
"<",
"<"}, {
">",
">"}};
0N/A * Return array of class members whose documentation is to be generated. 0N/A * If the member is deprecated do not include such a member in the 0N/A * @param members Array of members to choose from. 0N/A * @return ProgramElementDoc[] Array of eligible members for whom 0N/A * documentation is getting generated. 0N/A * Return array of class members whose documentation is to be generated. 0N/A * If the member is deprecated do not include such a member in the 0N/A * @param members Array of members to choose from. 0N/A * @return List List of eligible members for whom 0N/A * documentation is getting generated. 0N/A * Return the list of ProgramElementDoc objects as Array. 0N/A * Return true if a non-public member found in the given array. 0N/A * @param members Array of members to look into. 0N/A * @return boolean True if non-public member found, false otherwise. 0N/A * Search for the given method in the given class. 0N/A * @param cd Class to search into. 0N/A * @param method Method to be searched. 0N/A * @return MethodDoc Method found, null otherwise. 0N/A * @param member1 the first method to compare. 0N/A * @param member2 the second method to compare. 0N/A * According to the Java Language Specifications, all the outer classes 0N/A * and static inner classes are core classes. 0N/A * Copy source file to destination file. 0N/A * @throws SecurityException 0N/A * @throws IOException 0N/A * Copy the given directory contents from the source package directory 0N/A * to the generated documentation directory. For example for a package 0N/A * java.lang this method find out the source location of the package using 0N/A * {@link SourcePath} and if given directory is found in the source 0N/A * directory structure, copy the entire directory, to the generated 0N/A * documentation hierarchy. 0N/A * @param configuration The configuration of the current doclet. 0N/A * @param path The relative path to the directory to be copied. 0N/A * @param dir The original directory name to copy from. 0N/A * @param overwrite Overwrite files if true. 0N/A "doclet.Copy_Overwrite_warning",
0N/A "doclet.Copying_File_0_To_Dir_1",
0N/A * Given the parameters for copying doc-files, check for errors. 0N/A * @param configuration The configuration of the current doclet. 0N/A * @param path The relative path to the directory to be copied. 0N/A * @param dirName The original directory name to copy from. 0N/A //The destination path and source path are definitely equal. 0N/A //Check if the destination path is equal to the source path. If yes, 0N/A //do not copy doc-file directories. 0N/A //Make sure the doc-file being copied exists. 0N/A * Copy a file in the resources directory to the destination 0N/A * directory (if it is not there already). If 0N/A * <code>overwrite</code> is true and the destination file 0N/A * already exists, overwrite it. 0N/A * @param configuration Holds the destination directory and error message 0N/A * @param resourcefile The name of the resource file to copy 0N/A * @param overwrite A flag to indicate whether the file in the 0N/A * destination directory will be overwritten if 0N/A * it already exists. 0N/A * Given a PackageDoc, return the source path for that package. 0N/A * @param configuration The Configuration for the current Doclet. 0N/A * @param pkgDoc The package to seach the path for. 0N/A * @return A string representing the path to the given package. 0N/A //Make sure that both paths are using the same seperators. 0N/A * We want the list of types in alphabetical order. However, types are not 0N/A * comparable. We need a comparator for now. 0N/A * For the class return all implemented interfaces including the 0N/A * superinterfaces of the implementing interfaces, also iterate over for 0N/A * all the superclasses. For interface return all the extended interfaces 0N/A * as well as superinterfaces for those extended interfaces. 0N/A * @param type type whose implemented or 0N/A * super interfaces are sought. 0N/A * @param configuration the current configuration of the doclet. 0N/A * @param sort if true, return list of interfaces sorted alphabetically. 0N/A * @return List of all the required interfaces. 0N/A //Try walking the tree. 0N/A * Enclose in quotes, used for paths and filenames that contains spaces 0N/A * Given a package, return it's name. 0N/A * @param packageDoc the package to check. 0N/A * @return the name of the given package. 0N/A * Given a package, return it's file name without the extension. 0N/A * @param packageDoc the package to check. 0N/A * @return the file name of the given package. 0N/A * Given a string, replace all occurraces of 'newStr' with 'oldStr'. 0N/A * @param originalStr the string to modify. 0N/A * @param oldStr the string to replace. 0N/A * @param newStr the string to insert in place of the old string. 0N/A * Given a string, escape all special html characters and 0N/A * return the result. 0N/A * @param s The string to check. 0N/A * @return the original string with all of the HTML characters 0N/A * @see #HTML_ESCAPE_CHARS 0N/A * Create the directory path for the file to be generated, construct 0N/A * FileOutputStream and OutputStreamWriter depending upon docencoding. 0N/A * @param path The directory path to be created for this file. 0N/A * @param filename File Name to which the PrintWriter will do the Output. 0N/A * @param docencoding Encoding to be used for this file. 0N/A * @exception IOException Exception raised by the FileWriter is passed on 0N/A * @exception UnSupportedEncodingException Exception raised by the 0N/A * OutputStreamWriter is passed on to next level. 0N/A * @return Writer Writer for the file getting generated. 0N/A * @see java.io.FileOutputStream 0N/A * @see java.io.OutputStreamWriter 0N/A * Given an annotation, return true if it should be documented and false 0N/A * @param annotationDoc the annotation to check. 0N/A * @return true return true if it should be documented and false otherwise. 0N/A * Given a string, return an array of tokens. The separator can be escaped 0N/A * with the '\' character. The '\' character may also be escaped by the 0N/A * @param s the string to tokenize. 0N/A * @param separator the separator char. 0N/A * @param maxTokens the maxmimum number of tokens returned. If the 0N/A * max is reached, the remaining part of s is appended 0N/A * to the end of the last token. 0N/A * @return an array of tokens. 0N/A // Case 1: escaped character 0N/A // Case 2: separator 0N/A // Case 3: escape character 0N/A // Case 4: regular character 0N/A * Return true if this class is linkable and false if we can't link to the 0N/A * <b>NOTE:</b> You can only link to external classes if they are public or 0N/A * @param classDoc the class to check. 0N/A * @param configuration the current configuration of the doclet. 0N/A * @return true if this class is linkable and false if we can't link to the 0N/A * Given a class, return the closest visible super class. 0N/A * @param classDoc the class we are searching the parent for. 0N/A * @param configuration the current configuration of the doclet. 0N/A * @return the closest visible super class. Return null if it cannot 0N/A * be found (i.e. classDoc is java.lang.Object). 0N/A * Given a class, return the closest visible super class. 0N/A * @param classDoc the class we are searching the parent for. 0N/A * @param configuration the current configuration of the doclet. 0N/A * @return the closest visible super class. Return null if it cannot 0N/A * be found (i.e. classDoc is java.lang.Object). 0N/A * Given a ClassDoc, return the name of its type (Class, Interface, etc.). 0N/A * @param cd the ClassDoc to check. 0N/A * @param lowerCaseOnly true if you want the name returned in lower case. 0N/A * If false, the first letter of the name is capatilized. 0N/A * Given a string, replace all tabs with the appropriate 0N/A * @param tabLength the length of each tab. 0N/A * @param s the String to scan. 0N/A * The documentation for values() and valueOf() in Enums are set by the 0N/A * Return true if the given Doc is deprecated. 0N/A * @param doc the Doc to check. 0N/A * @return true if the given Doc is deprecated.