jdiff

Class API

public class API extends Object

The internal representation of an API. RootDoc could have been used for representing this, but you cannot serialize a RootDoc object - see http://developer.java.sun.com/developer/bugParade/bugs/4125581.html You might be able use Javadoc.Main() to create another RootDoc, but the methods are package private. You can run javadoc in J2SE1.4, see: http://java.sun.com/j2se/1.4/docs/tooldocs/javadoc/standard-doclet.html#runningprogrammatically but you still can't get the RootDoc object. The advantage of writing out an XML representation of each API is that later runs of JDiff don't have to have Javadoc scan all the files again, a possibly lengthy process. XML also permits other source code in languages other than Java to be scanned to produce XML, and then versions of JDiff can be used to create documents describing the difference in those APIs. See the file LICENSE.txt for copyright details.
Field Summary
Hashtableclasses_
The list of all the classes.
ClassAPIcurrClass_
The current class being added to during parsing.
ConstructorAPIcurrCtor_
The current constructor being added to during parsing.
FieldAPIcurrField_
The current field being added to during parsing.
MethodAPIcurrMethod_
The current method being added to during parsing.
PackageAPIcurrPkg_
The current package being added to during parsing.
static intindentInc
Amount by which to increment each indentation.
Stringname_
The String which identifies this API, e.g.
Listpackages_
The list of all the top-level packages.
Constructor Summary
API()
Default constructor.
Method Summary
static StringconvertHTMLTagsToXHTML(String htmlText)
NOT USED.
voiddump()
Display the contents of the API object.
static voiddumpClass(ClassAPI c, int indent)
Display the contents of a ClassAPI object.
static voiddumpCtor(ConstructorAPI c, int indent)
Display the contents of a constructor.
static voiddumpField(FieldAPI f, int indent)
Display the contents of a field.
static voiddumpMethod(MethodAPI m, int indent)
Display the contents of a MethodAPI object.
static voiddumpModifiers(Modifiers m, int indent)
Display the contents of the Modifiers object.
voiddumpPackage(PackageAPI pkg, int indent)
Display the contents of a PackageAPI object.
static voiddumpParam(ParamAPI p, int indent)
Display the contents of a parameter.
static StringhideHTMLTags(String htmlText)
Convert all HTML tags to text by stuffing text into the HTML tag to stop it being an HTML or XML tag.
static StringshowHTMLTags(String text)
Convert text with stuffed HTML tags ("lEsS_tHaN", etc) into HTML text.
static StringstuffHTMLTags(String htmlText)
Convert all HTML tags to text by placing them inside a CDATA element.

Field Detail

classes_

public Hashtable classes_
The list of all the classes. This is used to generate the methods and fields which are inherited, rather than storing them in the XML file.

currClass_

public ClassAPI currClass_
The current class being added to during parsing.

currCtor_

public ConstructorAPI currCtor_
The current constructor being added to during parsing.

currField_

public FieldAPI currField_
The current field being added to during parsing.

currMethod_

public MethodAPI currMethod_
The current method being added to during parsing.

currPkg_

public PackageAPI currPkg_
The current package being added to during parsing.

indentInc

public static final int indentInc
Amount by which to increment each indentation.

name_

public String name_
The String which identifies this API, e.g. "SuperProduct 1.3".

packages_

public List packages_
The list of all the top-level packages. Each package contains classes, each class contains members, and so on.

Constructor Detail

API

public API()
Default constructor.

Method Detail

convertHTMLTagsToXHTML

public static String convertHTMLTagsToXHTML(String htmlText)
NOT USED. Replace all instances of

with

. Just for the small number of HMTL tags which don't require a matching end tag. Also make HTML conform to the simple HTML requirements such as no double hyphens. Double hyphens are replaced by - and the character entity for a hyphen. Cases where this fails and has to be corrected in the XML by hand: Attributes' values missing their double quotes , e.g. size=-2 Mangled HTML tags e.g. <ttt>

NOT USED. There is often too much bad HTML in doc blocks to try to handle every case correctly. Better just to stuff the *lt; and &: characters with stuffHTMLTags(). Though the resulting XML is not as elegant, it does the job with less intervention by the user.

dump

public void dump()
Display the contents of the API object.

dumpClass

public static void dumpClass(ClassAPI c, int indent)
Display the contents of a ClassAPI object.

Parameters: c The given ClassAPI object. indent The number of spaces to indent the output.

dumpCtor

public static void dumpCtor(ConstructorAPI c, int indent)
Display the contents of a constructor.

Parameters: c The given constructor object. indent The number of spaces to indent the output.

dumpField

public static void dumpField(FieldAPI f, int indent)
Display the contents of a field. Does not show inherited fields.

Parameters: f The given field object. indent The number of spaces to indent the output.

dumpMethod

public static void dumpMethod(MethodAPI m, int indent)
Display the contents of a MethodAPI object.

Parameters: m The given MethodAPI object. indent The number of spaces to indent the output.

dumpModifiers

public static void dumpModifiers(Modifiers m, int indent)
Display the contents of the Modifiers object.

Parameters: c The given Modifiers object. indent The number of spaces to indent the output.

dumpPackage

public void dumpPackage(PackageAPI pkg, int indent)
Display the contents of a PackageAPI object.

Parameters: pkg The given PackageAPI object. indent The number of spaces to indent the output.

dumpParam

public static void dumpParam(ParamAPI p, int indent)
Display the contents of a parameter.

Parameters: p The given parameter object. indent The number of spaces to indent the output.

hideHTMLTags

public static String hideHTMLTags(String htmlText)
Convert all HTML tags to text by stuffing text into the HTML tag to stop it being an HTML or XML tag. E.g. "foo" becomes "lEsS_tHaNcode>foolEsS_tHaN/code>". Replace all < characters with the string "lEsS_tHaN". Also replace & character with the string "aNd_cHaR" to avoid text entities. Also replace " character with the string "qUoTe_cHaR".

showHTMLTags

public static String showHTMLTags(String text)
Convert text with stuffed HTML tags ("lEsS_tHaN", etc) into HTML text.

stuffHTMLTags

public static String stuffHTMLTags(String htmlText)
Convert all HTML tags to text by placing them inside a CDATA element. Characters still have to be valid Unicode characters as defined by the parser.