jdiff
Class HTMLReportGenerator
public
class
HTMLReportGenerator
extends Object
Emit HTML based on the changes between two sets of APIs.
See the file LICENSE.txt for copyright details.
Field Summary |
static String | docTitle
The title used on the first page of the report. |
static boolean | doStats To generate statistical output, set this to true. |
static String | newDocPrefix
Define the prefix for HTML links to the existing set of Javadoc-
generated documentation for the new API. |
static boolean | noCommentsOnAdditions
If set, then do not suggest comments for additions from the first
sentence of the doc block of the new API. |
static boolean | noCommentsOnChanges
If set, then do not suggest comments for changes from the first
sentence of the doc block of the new API. |
static boolean | noCommentsOnRemovals
If set, then do not suggest comments for removals from the first
sentence of the doc block of the old API. |
static String | oldDocPrefix
Define the prefix for HTML links to the existing set of Javadoc-
generated documentation for the old API. |
static String | outputDir
The destination directory for output files. |
static boolean | reportDocChanges
If set, then report changes in documentation (Javadoc comments)
between the old and the new API. |
static String | windowTitle
The browser window title for the report. |
Method Summary |
void | emitChanges(MemberDiff memberDiff, int memberType)
Emit all changes associated with a MemberDiff as an entry in a table.
|
void | emitComment(String commentID, String possibleComment, int linkType)
Find any existing comment and emit it. |
void | emitException(String ex)
Emit a string which is an exception by surrounding it with
<code> tags.
|
void | emitType(String type)
Emit a string which is a type by surrounding it with <code> tags.
|
static void | emitTypeWithNoParens(String type)
Emit a string which is a type by surrounding it with <code> tags.
|
static void | emitTypeWithParens(String type)
Emit a string which is a type by surrounding it with <code> tags.
|
static void | emitTypeWithParens(String type, boolean addBreaks)
Emit a string which is a type by surrounding it with <code> tags.
|
void | generate(APIComparator comp, Comments existingComments) Generate the report. |
Comments | getNewComments()
Accessor method for the freshly generated Comments object.
|
void | indent(int indent) Emit some non-breaking space for indentation. |
String | makeTwoRows(String name)
If a class or package name is considered to be too long for convenient
display, insert in the middle of it at a period. |
void | reportAllCtors(String pkgName, ClassDiff classDiff)
Write out the details of constructors in a class. |
void | reportAllFields(String pkgName, ClassDiff classDiff)
Write out the details of fields in a class. |
void | reportAllMethods(String pkgName, ClassDiff classDiff)
Write out the details of methods in a class. |
void | reportChangedClass(String pkgName, ClassDiff[] classDiffs, int classIndex)
Write out the details of a changed class in a separate file. |
void | reportChangedPackage(PackageDiff[] pkgDiffs, int pkgIndex)
Write out the details of a changed package in a separate file. |
static String | simpleName(String fqNames)
Return a String with the simple names of the classes in fqName.
|
void | writeClassTableEntry(String pkgName, String className, int linkType, boolean isInterface, String possibleComment, boolean useOld)
Write a table entry for a class or interface.
linkType: 0 - no link by default, 1 = link to Javadoc HTML file, 2 = link to JDiff file |
void | writeCtorChangedTableEntry(String pkgName, String className, MemberDiff memberDiff)
Write a table entry for a changed constructor. |
void | writeCtorTableEntry(String pkgName, String className, String type, int linkType, String possibleComment, boolean useOld)
Write a table entry for a constructor.
linkType: 0 - no link by default, 1 = link to Javadoc HTML file |
void | writeFieldChangedTableEntry(String pkgName, String className, MemberDiff memberDiff)
Write a table entry for a changed field. |
void | writeFieldTableEntry(String pkgName, String className, FieldAPI fieldAPI, int linkType, String possibleComment, boolean useOld)
Write a table entry for a field.
linkType: 0 - no link by default, 1 = link to Javadoc HTML file |
void | writeHTMLFooter() Write the HTML footer. |
void | writeHTMLTitle(String title) Write the HTML title |
void | writeMethodChangedTableEntry(String pkgName, String className, MemberDiff memberDiff)
Write a table entry for a changed method. |
void | writeMethodTableEntry(String pkgName, String className, MethodAPI methodAPI, int linkType, String possibleComment, boolean useOld)
Write a table entry for a method.
linkType: 0 - no link by default, 1 = link to Javadoc HTML file |
void | writeNavigationBar(String pkgName, String prevElemLink, String nextElemLink, String className, int level, boolean upperNavigationBar, boolean hasRemovals, boolean hasAdditions, boolean hasChanges)
Write a navigation bar section header.
|
void | writePackageTableEntry(String pkgName, int linkType, String possibleComment, boolean useOld)
Write a table entry for a package, with support for links to Javadoc
for removed packages.
linkType: 0 - no link by default, 1 = link to Javadoc HTML file, 2 = link to JDiff file |
void | writeReport(APIDiff apiDiff)
Write the HTML report.
|
void | writeSectionFooter(String packageName, String prevElemLink, String nextElemLink, String className, int level)
Write a section footer, which includes a navigation bar.
|
void | writeSectionHeader(String title, String packageName, String prevElemLink, String nextElemLink, String className, int level, boolean hasRemovals, boolean hasAdditions, boolean hasChanges)
Write a section header, which includes a navigation bar.
|
void | writeStartHTMLHeader() Write the start of the HTML header. |
void | writeStartHTMLHeader(boolean addDate) Write the start of the HTML header. |
void | writeStartHTMLHeaderWithDate()
Write the start of the HTML header, together with the current
date and time in an HTML comment. |
void | writeStyleSheetRef()
Write the HTML style sheet reference for files in the subdirectory. |
void | writeStyleSheetRef(boolean inSameDir)
Write the HTML style sheet reference. |
void | writeTableEnd() Write the end of a table. |
void | writeTableStart(String title, int colSpan) Write the start of a table. |
void | writeText() Write a newline out. |
void | writeText(String text) Write some text out. |
public static String docTitle
The title used on the first page of the report. By default, this is
"API Differences Between <name of old API> and
<name of new API>". It can be
set by using the -doctitle option.
public static boolean doStats
To generate statistical output, set this to true.
public static String newDocPrefix
Define the prefix for HTML links to the existing set of Javadoc-
generated documentation for the new API. E.g. For J2SE1.3.x, use
"http://java.sun.com/j2se/1.3/docs/api/"
public static boolean noCommentsOnAdditions
If set, then do not suggest comments for additions from the first
sentence of the doc block of the new API.
public static boolean noCommentsOnChanges
If set, then do not suggest comments for changes from the first
sentence of the doc block of the new API.
public static boolean noCommentsOnRemovals
If set, then do not suggest comments for removals from the first
sentence of the doc block of the old API.
public static String oldDocPrefix
Define the prefix for HTML links to the existing set of Javadoc-
generated documentation for the old API.
public static String outputDir
The destination directory for output files.
public static boolean reportDocChanges
If set, then report changes in documentation (Javadoc comments)
between the old and the new API. The default is that this is not set.
public static String windowTitle
The browser window title for the report. By default, this is
"API Differences Between <name of old API> and
<name of new API>". It can be
set by using the -windowtitle option.
public HTMLReportGenerator()
Default constructor.
public void emitChanges(MemberDiff memberDiff, int memberType)
Emit all changes associated with a MemberDiff as an entry in a table.
Parameters: memberType 0 = ctor, 1 = method, 2 = field
public void emitComment(String commentID, String possibleComment, int linkType)
Find any existing comment and emit it. Add the new comment to the
list of new comments. The first instance of the string "@first" in
a hand-written comment will be replaced by the first sentence from
the associated doc block, if such exists. Also replace @link by
an HTML link.
Parameters: commentID The identifier for this comment. possibleComment A possible comment from another source. linkType 0 = remove, 1 = add, 2 = change
public void emitException(String ex)
Emit a string which is an exception by surrounding it with
<code> tags.
If there is a space in the type, e.g. "String, File", then
surround it with parentheses too. Do not add <code> tags or
parentheses if the String is "no exceptions".
public void emitType(String type)
Emit a string which is a type by surrounding it with <code> tags.
If there is a space in the type, e.g. "String, File", then
surround it with parentheses too.
public static void emitTypeWithNoParens(String type)
Emit a string which is a type by surrounding it with <code> tags.
Do not surround it with parentheses. Used to display methods' return
types and field types.
public static void emitTypeWithParens(String type)
Emit a string which is a type by surrounding it with <code> tags.
Also surround it with parentheses too. Used to display methods'
parameters.
Suggestions for where a browser should break the
text are provided with <br> and <nobr> tags.
public static void emitTypeWithParens(String type, boolean addBreaks)
Emit a string which is a type by surrounding it with <code> tags.
Also surround it with parentheses too. Used to display methods'
parameters.
Generate the report.
Accessor method for the freshly generated Comments object.
The list of comments is sorted before the object is returned.
public void indent(int indent)
Emit some non-breaking space for indentation.
public String makeTwoRows(String name)
If a class or package name is considered to be too long for convenient
display, insert
in the middle of it at a period.
public void reportAllCtors(String pkgName, ClassDiff classDiff)
Write out the details of constructors in a class.
public void reportAllFields(String pkgName, ClassDiff classDiff)
Write out the details of fields in a class.
public void reportAllMethods(String pkgName, ClassDiff classDiff)
Write out the details of methods in a class.
public void reportChangedClass(String pkgName, ClassDiff[] classDiffs, int classIndex)
Write out the details of a changed class in a separate file.
public void reportChangedPackage(PackageDiff[] pkgDiffs, int pkgIndex)
Write out the details of a changed package in a separate file.
public static String simpleName(String fqNames)
Return a String with the simple names of the classes in fqName.
"java.lang.String" becomes "String",
"java.lang.String, java.io.File" becomes "String, File"
and so on. If fqName is null, return null. If fqName is "",
return "".
public void writeClassTableEntry(String pkgName, String className, int linkType, boolean isInterface, String possibleComment, boolean useOld)
Write a table entry for a class or interface.
linkType: 0 - no link by default, 1 = link to Javadoc HTML file, 2 = link to JDiff file
public void writeCtorChangedTableEntry(String pkgName, String className, MemberDiff memberDiff)
Write a table entry for a changed constructor.
public void writeCtorTableEntry(String pkgName, String className, String type, int linkType, String possibleComment, boolean useOld)
Write a table entry for a constructor.
linkType: 0 - no link by default, 1 = link to Javadoc HTML file
public void writeFieldChangedTableEntry(String pkgName, String className, MemberDiff memberDiff)
Write a table entry for a changed field.
public void writeFieldTableEntry(String pkgName, String className, FieldAPI fieldAPI, int linkType, String possibleComment, boolean useOld)
Write a table entry for a field.
linkType: 0 - no link by default, 1 = link to Javadoc HTML file
public void writeHTMLFooter()
Write the HTML footer.
public void writeHTMLTitle(String title)
Write the HTML title
public void writeMethodChangedTableEntry(String pkgName, String className, MemberDiff memberDiff)
Write a table entry for a changed method.
public void writeMethodTableEntry(String pkgName, String className, MethodAPI methodAPI, int linkType, String possibleComment, boolean useOld)
Write a table entry for a method.
linkType: 0 - no link by default, 1 = link to Javadoc HTML file
public void writeNavigationBar(String pkgName, String prevElemLink, String nextElemLink, String className, int level, boolean upperNavigationBar, boolean hasRemovals, boolean hasAdditions, boolean hasChanges)
Write a navigation bar section header.
Parameters: pkgName The name of the current package, with no slashes or
links in it. prevElemLink An HTML link to the previous element (a package or
class). May be null. nextElemLink An HTML link to the next element (a package or
class). May be null. className The name of the current class, with no slashes or
links in it. May be null. level 0 = overview, 1 = package, 2 = class/interface
public void writePackageTableEntry(String pkgName, int linkType, String possibleComment, boolean useOld)
Write a table entry for a package, with support for links to Javadoc
for removed packages.
linkType: 0 - no link by default, 1 = link to Javadoc HTML file, 2 = link to JDiff file
public void writeReport(
APIDiff apiDiff)
Write the HTML report.
The top section describes all the packages added (with links) and
removed, and the changed packages section has links which takes you
to a section for each package. This pattern continues for classes and
constructors, methods and fields.
public void writeSectionFooter(String packageName, String prevElemLink, String nextElemLink, String className, int level)
Write a section footer, which includes a navigation bar.
Parameters: packageName The name of the current package, with no slashes or
links in it. may be null prevElemLink An HTML link to the previous element (a package or
class). May be null. nextElemLink An HTML link to the next element (a package or
class). May be null. className The name of the current class, with no slashes or
links in it. May be null level 0 = overview, 1 = package, 2 = class/interface
public void writeSectionHeader(String title, String packageName, String prevElemLink, String nextElemLink, String className, int level, boolean hasRemovals, boolean hasAdditions, boolean hasChanges)
Write a section header, which includes a navigation bar.
Parameters: title Title of the header. Contains any links necessary. packageName The name of the current package, with no slashes or
links in it. May be null prevElemLink An HTML link to the previous element (a package or
class). May be null. nextElemLink An HTML link to the next element (a package or
class). May be null. className The name of the current class, with no slashes or
links in it. May be null. level 0 = overview, 1 = package, 2 = class/interface
public void writeStartHTMLHeader()
Write the start of the HTML header.
public void writeStartHTMLHeader(boolean addDate)
Write the start of the HTML header.
public void writeStartHTMLHeaderWithDate()
Write the start of the HTML header, together with the current
date and time in an HTML comment.
public void writeStyleSheetRef()
Write the HTML style sheet reference for files in the subdirectory.
public void writeStyleSheetRef(boolean inSameDir)
Write the HTML style sheet reference. If inSameDir is set, don't add
"../" to the location.
public void writeTableEnd()
Write the end of a table.
public void writeTableStart(String title, int colSpan)
Write the start of a table.
public void writeText()
Write a newline out.
public void writeText(String text)
Write some text out.