jdiff
Class XMLToAPI

java.lang.Object
  extended byjdiff.XMLToAPI

public class XMLToAPI
extends java.lang.Object

Creates an API object from an XML file. The API object is the internal representation of an API. All methods in this class for populating an API object are static. See the file LICENSE.txt for copyright details.


Field Summary
static boolean validateXML
          If set, validate the XML which represents an API.
 
Method Summary
static void addClass(java.lang.String name, java.lang.String parent, boolean isAbstract, jdiff.Modifiers modifiers)
          Create a new class and add it to the current package.
static void addCtor(java.lang.String type, jdiff.Modifiers modifiers)
          Add a constructor to the current class.
static void addException(java.lang.String name, java.lang.String type, java.lang.String currElement)
          Add an exception to the current method or constructor.
static void addField(java.lang.String name, java.lang.String type, boolean isTransient, boolean isVolatile, java.lang.String value, jdiff.Modifiers modifiers)
          Add a field to the current class.
static void addImplements(java.lang.String name)
          Add an inherited interface to the current class.
static void addInheritedElements()
          Add the inherited methods and fields to each class in turn.
static void addInheritedElements(jdiff.ClassAPI child, jdiff.ClassAPI parent, java.lang.String fqParentName)
          Add all the inherited methods and fields in the second class to the first class, marking them as inherited from the second class.
static void addInterface(java.lang.String name, java.lang.String parent, boolean isAbstract, jdiff.Modifiers modifiers)
          Add an new interface and add it to the current package.
static void addMethod(java.lang.String name, java.lang.String returnType, boolean isAbstract, boolean isNative, boolean isSynchronized, jdiff.Modifiers modifiers)
          Add a method to the current class.
static void addPackage(java.lang.String name)
          Create a new package and add it to the API.
static void addParam(java.lang.String name, java.lang.String type)
          Add a parameter to the current method.
static void nameAPI(java.lang.String name)
          Set the name of the API object.
static API readFile(java.lang.String filename, boolean createGlobalComments, java.lang.String apiName)
          Read the file where the XML representing the API is stored.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

validateXML

public static boolean validateXML
If set, validate the XML which represents an API. By default, this is not set for reasons of efficiency, and also because if JDiff generated the XML, it should not need validating.

Method Detail

readFile

public static API readFile(java.lang.String filename,
                           boolean createGlobalComments,
                           java.lang.String apiName)
Read the file where the XML representing the API is stored.

Parameters:
filename - The full name of the file containing the XML representing the API
apiName - The simple name of the API file. If -oldapidir and -newapidir are not used, then this is the same as the filename parameter

addInheritedElements

public static void addInheritedElements()
Add the inherited methods and fields to each class in turn.


addInheritedElements

public static void addInheritedElements(jdiff.ClassAPI child,
                                        jdiff.ClassAPI parent,
                                        java.lang.String fqParentName)
Add all the inherited methods and fields in the second class to the first class, marking them as inherited from the second class. Do not add a method or a field if it is already defined locally. Only elements at the specified visibility level or higher appear in the XML file. All that remains to be tested for a private element, which is never inherited. If the parent class inherits any classes or interfaces, call this method recursively with those parents.


nameAPI

public static void nameAPI(java.lang.String name)
Set the name of the API object.

Parameters:
name - The name of the package.

addPackage

public static void addPackage(java.lang.String name)
Create a new package and add it to the API. Called by the XML parser.

Parameters:
name - The name of the package.

addClass

public static void addClass(java.lang.String name,
                            java.lang.String parent,
                            boolean isAbstract,
                            jdiff.Modifiers modifiers)
Create a new class and add it to the current package. Called by the XML parser.

Parameters:
name - The name of the class.
parent - The name of the parent class, null if no class is extended.
modifiers - Modifiers for this class.

addInterface

public static void addInterface(java.lang.String name,
                                java.lang.String parent,
                                boolean isAbstract,
                                jdiff.Modifiers modifiers)
Add an new interface and add it to the current package. Called by the XML parser.

Parameters:
name - The name of the interface.
parent - The name of the parent interface, null if no interface is extended.

addImplements

public static void addImplements(java.lang.String name)
Add an inherited interface to the current class. Called by the XML parser.

Parameters:
name - The name of the inherited interface.

addCtor

public static void addCtor(java.lang.String type,
                           jdiff.Modifiers modifiers)
Add a constructor to the current class. Called by the XML parser.

Parameters:
type - The type of the constructor.
modifiers - Modifiers for this constructor.

addMethod

public static void addMethod(java.lang.String name,
                             java.lang.String returnType,
                             boolean isAbstract,
                             boolean isNative,
                             boolean isSynchronized,
                             jdiff.Modifiers modifiers)
Add a method to the current class. Called by the XML parser.

Parameters:
name - The name of the method.
returnType - The return type of the method, null if it is void.
modifiers - Modifiers for this method.

addField

public static void addField(java.lang.String name,
                            java.lang.String type,
                            boolean isTransient,
                            boolean isVolatile,
                            java.lang.String value,
                            jdiff.Modifiers modifiers)
Add a field to the current class. Called by the XML parser.

Parameters:
name - The name of the field.
type - The type of the field, null if it is void.
modifiers - Modifiers for this field.

addParam

public static void addParam(java.lang.String name,
                            java.lang.String type)
Add a parameter to the current method. Called by the XML parser. Constuctors have their type (signature) in an attribute, since it is often shorter and makes parsing a little easier.

Parameters:
name - The name of the parameter.
type - The type of the parameter, null if it is void.

addException

public static void addException(java.lang.String name,
                                java.lang.String type,
                                java.lang.String currElement)
Add an exception to the current method or constructor. Called by the XML parser.

Parameters:
name - The name of the parameter.
type - The type of the parameter. May be null in JDiff1.0.8 and earlier versions.
currElement - Name of the current element.