|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.sun.tools.doclets.internal.toolkit.util.Util
public class Util
Utilities Class for Doclets. This code is not part of an API. It is implementation that is subject to change. Do not use it as an API
| Nested Class Summary | |
|---|---|
private static class |
Util.TypeComparator
We want the list of types in alphabetical order. |
| Field Summary | |
|---|---|
static java.lang.String[][] |
HTML_ESCAPE_CHARS
A mapping between characters and their corresponding HTML escape character. |
| Constructor Summary | |
|---|---|
Util()
|
|
| Method Summary | ||
|---|---|---|
private static void |
addAllInterfaceTypes(java.util.Map<ClassDoc,Type> results,
Type type,
Type[] interfaceTypes,
boolean raw,
Configuration configuration)
|
|
static
|
asList(T[] members)
|
|
private static boolean |
checkCopyDocFilesErrors(Configuration configuration,
java.lang.String path,
java.lang.String dirName)
Given the parameters for copying doc-files, check for errors. |
|
static void |
copyDocFiles(Configuration configuration,
java.lang.String path,
java.lang.String dir,
boolean overwrite)
Copy the given directory contents from the source package directory to the generated documentation directory. |
|
static void |
copyFile(java.io.File destfile,
java.io.File srcfile)
Copy source file to destination file. |
|
static void |
copyResourceFile(Configuration configuration,
java.lang.String resourcefile,
boolean overwrite)
Copy a file in the resources directory to the destination directory (if it is not there already). |
|
static java.lang.String |
escapeHtmlChars(java.lang.String s)
Given a string, escape all special html characters and return the result. |
|
static ProgramElementDoc[] |
excludeDeprecatedMembers(ProgramElementDoc[] members)
Return array of class members whose documentation is to be generated. |
|
static java.util.List<ProgramElementDoc> |
excludeDeprecatedMembersAsList(ProgramElementDoc[] members)
Return array of class members whose documentation is to be generated. |
|
static boolean |
executableMembersEqual(ExecutableMemberDoc member1,
ExecutableMemberDoc member2)
|
|
private static void |
findAllInterfaceTypes(java.util.Map<ClassDoc,Type> results,
ClassDoc c,
boolean raw,
Configuration configuration)
|
|
private static void |
findAllInterfaceTypes(java.util.Map<ClassDoc,Type> results,
ParameterizedType p,
Configuration configuration)
|
|
static MethodDoc |
findMethod(ClassDoc cd,
MethodDoc method)
Search for the given method in the given class. |
|
static java.io.Writer |
genWriter(Configuration configuration,
java.lang.String path,
java.lang.String filename,
java.lang.String docencoding)
Create the directory path for the file to be generated, construct FileOutputStream and OutputStreamWriter depending upon docencoding. |
|
static java.util.List<Type> |
getAllInterfaces(Type type,
Configuration configuration)
|
|
static java.util.List<Type> |
getAllInterfaces(Type type,
Configuration configuration,
boolean sort)
For the class return all implemented interfaces including the superinterfaces of the implementing interfaces, also iterate over for all the superclasses. |
|
static Type |
getFirstVisibleSuperClass(ClassDoc classDoc,
Configuration configuration)
Given a class, return the closest visible super class. |
|
static ClassDoc |
getFirstVisibleSuperClassCD(ClassDoc classDoc,
Configuration configuration)
Given a class, return the closest visible super class. |
|
static java.lang.String |
getPackageFileHeadName(PackageDoc packageDoc)
Given a package, return it's file name without the extension. |
|
static java.lang.String |
getPackageName(PackageDoc packageDoc)
Given a package, return it's name. |
|
static java.lang.String |
getPackageSourcePath(Configuration configuration,
PackageDoc pkgDoc)
Given a PackageDoc, return the source path for that package. |
|
static java.lang.String |
getTypeName(Configuration config,
ClassDoc cd,
boolean lowerCaseOnly)
Given a ClassDoc, return the name of its type (Class, Interface, etc.). |
|
static boolean |
isCoreClass(ClassDoc cd)
According to the Java Language Specifications, all the outer classes and static inner classes are core classes. |
|
static boolean |
isDeprecated(ProgramElementDoc doc)
Return true if the given Doc is deprecated. |
|
static boolean |
isDocumentedAnnotation(AnnotationTypeDoc annotationDoc)
Given an annotation, return true if it should be documented and false otherwise. |
|
static boolean |
isLinkable(ClassDoc classDoc,
Configuration configuration)
Return true if this class is linkable and false if we can't link to the desired class. |
|
static boolean |
matches(ProgramElementDoc doc1,
ProgramElementDoc doc2)
|
|
static boolean |
nonPublicMemberFound(ProgramElementDoc[] members)
Return true if a non-public member found in the given array. |
|
static java.lang.String |
quote(java.lang.String filepath)
Enclose in quotes, used for paths and filenames that contains spaces |
|
static void |
replaceTabs(int tabLength,
java.lang.StringBuffer s)
Given a string, replace all tabs with the appropriate number of spaces. |
|
static java.lang.String |
replaceText(java.lang.String originalStr,
java.lang.String oldStr,
java.lang.String newStr)
Given a string, replace all occurraces of 'newStr' with 'oldStr'. |
|
static void |
setEnumDocumentation(Configuration configuration,
ClassDoc classDoc)
The documentation for values() and valueOf() in Enums are set by the doclet. |
|
static java.lang.String[] |
tokenize(java.lang.String s,
char separator,
int maxTokens)
Given a string, return an array of tokens. |
|
static ProgramElementDoc[] |
toProgramElementDocArray(java.util.List<ProgramElementDoc> list)
Return the list of ProgramElementDoc objects as Array. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String[][] HTML_ESCAPE_CHARS
| Constructor Detail |
|---|
public Util()
| Method Detail |
|---|
public static ProgramElementDoc[] excludeDeprecatedMembers(ProgramElementDoc[] members)
members - Array of members to choose from.
public static java.util.List<ProgramElementDoc> excludeDeprecatedMembersAsList(ProgramElementDoc[] members)
members - Array of members to choose from.
public static ProgramElementDoc[] toProgramElementDocArray(java.util.List<ProgramElementDoc> list)
public static boolean nonPublicMemberFound(ProgramElementDoc[] members)
members - Array of members to look into.
public static MethodDoc findMethod(ClassDoc cd,
MethodDoc method)
cd - Class to search into.method - Method to be searched.
public static boolean executableMembersEqual(ExecutableMemberDoc member1,
ExecutableMemberDoc member2)
member1 - the first method to compare.member2 - the second method to compare.
public static boolean isCoreClass(ClassDoc cd)
public static boolean matches(ProgramElementDoc doc1,
ProgramElementDoc doc2)
public static void copyFile(java.io.File destfile,
java.io.File srcfile)
throws java.io.IOException
java.lang.SecurityException
java.io.IOException
public static void copyDocFiles(Configuration configuration,
java.lang.String path,
java.lang.String dir,
boolean overwrite)
SourcePath and if given directory is found in the source
directory structure, copy the entire directory, to the generated
documentation hierarchy.
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.
private static boolean checkCopyDocFilesErrors(Configuration configuration,
java.lang.String path,
java.lang.String dirName)
configuration - The configuration of the current doclet.path - The relative path to the directory to be copied.dirName - The original directory name to copy from.
public static void copyResourceFile(Configuration configuration,
java.lang.String resourcefile,
boolean overwrite)
overwrite is true and the destination file
already exists, overwrite it.
configuration - Holds the destination directory and error messageresourcefile - The name of the resource file to copyoverwrite - A flag to indicate whether the file in the
destination directory will be overwritten if
it already exists.
public static java.lang.String getPackageSourcePath(Configuration configuration,
PackageDoc pkgDoc)
configuration - The Configuration for the current Doclet.pkgDoc - The package to seach the path for.
public static java.util.List<Type> getAllInterfaces(Type type,
Configuration configuration,
boolean sort)
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.
public static java.util.List<Type> getAllInterfaces(Type type,
Configuration configuration)
private static void findAllInterfaceTypes(java.util.Map<ClassDoc,Type> results,
ClassDoc c,
boolean raw,
Configuration configuration)
private static void findAllInterfaceTypes(java.util.Map<ClassDoc,Type> results,
ParameterizedType p,
Configuration configuration)
private static void addAllInterfaceTypes(java.util.Map<ClassDoc,Type> results,
Type type,
Type[] interfaceTypes,
boolean raw,
Configuration configuration)
public static <T extends ProgramElementDoc> java.util.List<T> asList(T[] members)
public static java.lang.String quote(java.lang.String filepath)
public static java.lang.String getPackageName(PackageDoc packageDoc)
packageDoc - the package to check.
public static java.lang.String getPackageFileHeadName(PackageDoc packageDoc)
packageDoc - the package to check.
public static java.lang.String replaceText(java.lang.String originalStr,
java.lang.String oldStr,
java.lang.String newStr)
originalStr - the string to modify.oldStr - the string to replace.newStr - the string to insert in place of the old string.public static java.lang.String escapeHtmlChars(java.lang.String s)
s - The string to check.
HTML_ESCAPE_CHARS
public static java.io.Writer genWriter(Configuration configuration,
java.lang.String path,
java.lang.String filename,
java.lang.String docencoding)
throws java.io.IOException,
java.io.UnsupportedEncodingException
path - The directory path to be created for this file.filename - File Name to which the PrintWriter will do the Output.docencoding - Encoding to be used for this file.
java.io.IOException - Exception raised by the FileWriter is passed on
to next level.
java.io.UnsupportedEncodingException - Exception raised by the
OutputStreamWriter is passed on to next level.FileOutputStream,
OutputStreamWriterpublic static boolean isDocumentedAnnotation(AnnotationTypeDoc annotationDoc)
annotationDoc - the annotation to check.
public static java.lang.String[] tokenize(java.lang.String s,
char separator,
int maxTokens)
s - the string to tokenize.separator - the separator char.maxTokens - the maxmimum number of tokens returned. If the
max is reached, the remaining part of s is appended
to the end of the last token.
public static boolean isLinkable(ClassDoc classDoc,
Configuration configuration)
classDoc - the class to check.configuration - the current configuration of the doclet.
public static Type getFirstVisibleSuperClass(ClassDoc classDoc,
Configuration configuration)
classDoc - the class we are searching the parent for.configuration - the current configuration of the doclet.
public static ClassDoc getFirstVisibleSuperClassCD(ClassDoc classDoc,
Configuration configuration)
classDoc - the class we are searching the parent for.configuration - the current configuration of the doclet.
public static java.lang.String getTypeName(Configuration config,
ClassDoc cd,
boolean lowerCaseOnly)
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 capatilized.
public static void replaceTabs(int tabLength,
java.lang.StringBuffer s)
tabLength - the length of each tab.s - the String to scan.
public static void setEnumDocumentation(Configuration configuration,
ClassDoc classDoc)
public static boolean isDeprecated(ProgramElementDoc doc)
doc - the Doc to check.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||