jdiff
Class API

java.lang.Object
  extended by jdiff.API

public class API
extends java.lang.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
 java.util.Hashtable classes_
          The list of all the classes.
 jdiff.ClassAPI currClass_
          The current class being added to during parsing.
 jdiff.ConstructorAPI currCtor_
          The current constructor being added to during parsing.
 jdiff.FieldAPI currField_
          The current field being added to during parsing.
 jdiff.MethodAPI currMethod_
          The current method being added to during parsing.
 jdiff.PackageAPI currPkg_
          The current package being added to during parsing.
static int indentInc
          Amount by which to increment each indentation.
 java.lang.String name_
          The String which identifies this API, e.g.
 java.util.List packages_
          The list of all the top-level packages.
 
Constructor Summary
API()
          Default constructor.
 
Method Summary
static java.lang.String convertHTMLTagsToXHTML(java.lang.String htmlText)
          NOT USED.
 void dump()
          Display the contents of the API object.
static void dumpClass(jdiff.ClassAPI c, int indent)
          Display the contents of a ClassAPI object.
static void dumpCtor(jdiff.ConstructorAPI c, int indent)
          Display the contents of a constructor.
static void dumpField(jdiff.FieldAPI f, int indent)
          Display the contents of a field.
static void dumpMethod(jdiff.MethodAPI m, int indent)
          Display the contents of a MethodAPI object.
static void dumpModifiers(jdiff.Modifiers m, int indent)
          Display the contents of the Modifiers object.
 void dumpPackage(jdiff.PackageAPI pkg, int indent)
          Display the contents of a PackageAPI object.
static void dumpParam(jdiff.ParamAPI p, int indent)
          Display the contents of a parameter.
static java.lang.String hideHTMLTags(java.lang.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 java.lang.String showHTMLTags(java.lang.String text)
          Convert text with stuffed HTML tags ("lEsS_tHaN", etc) into HTML text.
static java.lang.String stuffHTMLTags(java.lang.String htmlText)
          Convert all HTML tags to text by placing them inside a CDATA element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

packages_

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


classes_

public java.util.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.


name_

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


currPkg_

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


currClass_

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


currCtor_

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


currMethod_

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


currField_

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


indentInc

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

See Also:
Constant Field Values
Constructor Detail

API

public API()
Default constructor.

Method Detail

dump

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


dumpPackage

public void dumpPackage(jdiff.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.

dumpClass

public static void dumpClass(jdiff.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.

dumpModifiers

public static void dumpModifiers(jdiff.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.

dumpCtor

public static void dumpCtor(jdiff.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.

dumpMethod

public static void dumpMethod(jdiff.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.

dumpField

public static void dumpField(jdiff.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.

dumpParam

public static void dumpParam(jdiff.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.

stuffHTMLTags

public static java.lang.String stuffHTMLTags(java.lang.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.


hideHTMLTags

public static java.lang.String hideHTMLTags(java.lang.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 java.lang.String showHTMLTags(java.lang.String text)
Convert text with stuffed HTML tags ("lEsS_tHaN", etc) into HTML text.


convertHTMLTagsToXHTML

public static java.lang.String convertHTMLTagsToXHTML(java.lang.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.