org.znerd.javadoxml
Class JavadoXML

java.lang.Object
  |
  +--com.sun.javadoc.Doclet
        |
        +--org.znerd.javadoxml.JavadoXML

public final class JavadoXML
extends com.sun.javadoc.Doclet

Doclet that generates XML output.

This doclet recognizes the following options:

-out
The output file to write to. The default is apidocs.xml.
-indent
The indentation to use, if any. The default is no indentation..
-newlines
Flag that indicates if newlines should be used. Valid values are true or yes if newlines should be used, and false or no if no newlines should be used. The default is no.
-encoding
The encoding to use. The default is UTF-8.

Version:
$Revision: 1.21 $ $Date: 2003/04/26 15:20:55 $
Author:
Ernst de Haan (znerd@FreeBSD.org)

Field Summary
private  String _destdir
          The parent directory for the output file.
private  String _encoding
          The encoding to use for the output file.
private  String _filename
          The name of the file to write the output to.
private  String _indent
          The indentation to use.
private  boolean _newlines
          Flag that indicates if newlines should be output.
private  XMLOutputter _outputter
          The XMLOutputter that is used to generate XML with.
private  com.sun.javadoc.RootDoc _root
          The starting point for this Javadoc run.
private  boolean _running
          Flag that indicates if this doclet is currently running.
private static String DEFAULT_DESTDIR
          The default destination directory.
private static String DEFAULT_ENCODING
          The default encoding.
private static String DEFAULT_FILENAME
          The default output filename.
private static String DEFAULT_INDENT
          The default indentation.
private static boolean DEFAULT_NEWLINES
          The default setting for newlines.
 
Constructor Summary
private JavadoXML()
          Constructs a new JavadoXML object.
 
Method Summary
private  void attribute(String attribute, boolean cond)
           
private  void createDocument()
          Writes the XML document.
private  void handle(com.sun.javadoc.ClassDoc c)
           
private  void handle(com.sun.javadoc.ClassDoc[] classes)
          Creates XML output for the specified classes.
private  void handle(com.sun.javadoc.ConstructorDoc c)
           
private  void handle(com.sun.javadoc.ConstructorDoc[] constructors)
          Creates XML output for the specified constructors.
private  void handle(com.sun.javadoc.FieldDoc f)
           
private  void handle(com.sun.javadoc.FieldDoc[] fields)
          Creates XML output for the specified fields.
private  void handle(com.sun.javadoc.MethodDoc m)
           
private  void handle(com.sun.javadoc.MethodDoc[] methods)
          Creates XML output for the specified methods.
private  void handle(com.sun.javadoc.PackageDoc p)
          Creates XML output for an individual package.
private  void handle(com.sun.javadoc.PackageDoc[] packages)
          Creates XML output for the specified packages.
private  void handle(com.sun.javadoc.Parameter p)
           
private  void handle(com.sun.javadoc.Tag tag)
           
private  void handleDoc(com.sun.javadoc.Doc doc)
           
private  void handleParameters(com.sun.javadoc.ExecutableMemberDoc d)
           
private  void handleProgramElement(com.sun.javadoc.ProgramElementDoc p)
           
private  void interpretOptions()
          Interprets the options.
static int optionLength(String option)
          Checks a doclet option.
 boolean run(com.sun.javadoc.RootDoc root)
          Runs this doclet.
private  boolean runImpl()
           
static boolean start(com.sun.javadoc.RootDoc root)
          Generates the XML API documentation.
 
Methods inherited from class com.sun.javadoc.Doclet
validOptions
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

DEFAULT_FILENAME

private static final String DEFAULT_FILENAME
The default output filename.

DEFAULT_DESTDIR

private static final String DEFAULT_DESTDIR
The default destination directory. The value of this constant is ".", the current directory.

DEFAULT_INDENT

private static final String DEFAULT_INDENT
The default indentation. The value of this constant is "", the empty string.

DEFAULT_NEWLINES

private static final boolean DEFAULT_NEWLINES
The default setting for newlines. By default no newlines will be inserted.

DEFAULT_ENCODING

private static final String DEFAULT_ENCODING
The default encoding. The value of this constant is "UTF-8".

_running

private transient boolean _running
Flag that indicates if this doclet is currently running. One instance can only run within one thread at the same time.

_root

private transient com.sun.javadoc.RootDoc _root
The starting point for this Javadoc run. This field is initialized by run(RootDoc).

_filename

private String _filename
The name of the file to write the output to. This is a path relative to the destination directory.

The default is DEFAULT_FILENAME.


_destdir

private String _destdir
The parent directory for the output file.

The default is DEFAULT_DESTDIR.


_indent

private String _indent
The indentation to use.

The default is DEFAULT_INDENT.


_newlines

private boolean _newlines
Flag that indicates if newlines should be output.

The default is DEFAULT_NEWLINES.


_encoding

private String _encoding
The encoding to use for the output file.

The default is DEFAULT_ENCODING.


_outputter

private XMLOutputter _outputter
The XMLOutputter that is used to generate XML with.
Constructor Detail

JavadoXML

private JavadoXML()
Constructs a new JavadoXML object.
Method Detail

optionLength

public static int optionLength(String option)
                        throws IllegalArgumentException
Checks a doclet option.
Parameters:
option - the doclet option to check, not null.
Returns:
the number of arguments the option has, or 0 (zero) if the argument is unknown, or a negative value in case of an error.
Throws:
IllegalArgumentException - if option == null.

start

public static boolean start(com.sun.javadoc.RootDoc root)
                     throws IllegalArgumentException
Generates the XML API documentation.
Parameters:
root - the packages and/or classes to document, not null.
Returns:
true on success, false otherwise.
Throws:
IllegalArgumentException - if root == null.

run

public boolean run(com.sun.javadoc.RootDoc root)
            throws IllegalArgumentException,
                   IllegalStateException
Runs this doclet.
Parameters:
root - the packages and/or classes to document, not null.
Returns:
true on success, false otherwise.
Throws:
IllegalArgumentException - if root == null.
IllegalStateException - if this doclet is currently already running.

runImpl

private boolean runImpl()

interpretOptions

private void interpretOptions()
Interprets the options.

createDocument

private void createDocument()
                     throws IOException
Writes the XML document.
Throws:
IOException - if there was an I/O error.

handle

private void handle(com.sun.javadoc.PackageDoc[] packages)
             throws IOException
Creates XML output for the specified packages.

This method delegates to handle(PackageDoc).

Parameters:
packages - the packages to be processed, can be null.
Throws:
IOException - if there was an I/O error.

handle

private void handle(com.sun.javadoc.PackageDoc p)
             throws IOException
Creates XML output for an individual package.
Parameters:
packages - the package to be processed, not null.

handleDoc

private void handleDoc(com.sun.javadoc.Doc doc)
                throws IOException

handle

private void handle(com.sun.javadoc.Tag tag)
             throws IOException

handle

private void handle(com.sun.javadoc.ClassDoc[] classes)
             throws IOException
Creates XML output for the specified classes.

This method delegates to handle(ClassDoc).

Parameters:
classes - the classes to be processed, can be null.

handle

private void handle(com.sun.javadoc.ClassDoc c)
             throws IOException

handle

private void handle(com.sun.javadoc.ConstructorDoc[] constructors)
             throws IOException
Creates XML output for the specified constructors.

This method delegates to handle(ConstructorDoc).

Parameters:
constructors - the constructors to be processed, can be null.

handle

private void handle(com.sun.javadoc.ConstructorDoc c)
             throws IOException

handle

private void handle(com.sun.javadoc.MethodDoc[] methods)
             throws IOException
Creates XML output for the specified methods.

This method delegates to handle(MethodDoc).

Parameters:
methods - the methods to be processed, can be null.

handle

private void handle(com.sun.javadoc.MethodDoc m)
             throws IOException

handle

private void handle(com.sun.javadoc.FieldDoc[] fields)
             throws IOException
Creates XML output for the specified fields.

This method delegates to handle(MethodDoc).

Parameters:
fields - the fields to be processed, can be null.

handle

private void handle(com.sun.javadoc.FieldDoc f)
             throws IOException

handleProgramElement

private void handleProgramElement(com.sun.javadoc.ProgramElementDoc p)
                           throws IOException

handleParameters

private void handleParameters(com.sun.javadoc.ExecutableMemberDoc d)
                       throws IOException

handle

private void handle(com.sun.javadoc.Parameter p)
             throws IOException

attribute

private void attribute(String attribute,
                       boolean cond)
                throws IOException


Copyright © Ernst de Haan
See http://javadoxml.sourceforge.net/.
This Javadoc API documentation set contains private and package private members as well.