com.sun.tools.doclets.internal.toolkit.builders
Class ConstantsSummaryBuilder

java.lang.Object
  extended by com.sun.tools.doclets.internal.toolkit.builders.AbstractBuilder
      extended by com.sun.tools.doclets.internal.toolkit.builders.ConstantsSummaryBuilder

public class ConstantsSummaryBuilder
extends AbstractBuilder

Builds the Constants Summary Page. This code is not part of an API. It is implementation that is subject to change. Do not use it as an API

Since:
1.5

Nested Class Summary
private  class ConstantsSummaryBuilder.ConstantFieldBuilder
          Print the table of constants.
 
Field Summary
protected  java.util.Set<ClassDoc> classDocsWithConstFields
          The set of ClassDocs that have constant fields.
private  ClassDoc currentClass
          The current class being documented.
private  PackageDoc currentPackage
          The current package being documented.
static int MAX_CONSTANT_VALUE_INDEX_LENGTH
          The maximum number of package directories shown in the constant value index.
protected  java.util.Set<java.lang.String> printedPackageHeaders
          The set of printed package headers.
static java.lang.String ROOT
          The root element of the constant summary XML is "ConstantSummary".
protected  ConstantsSummaryWriter writer
          The writer used to write the results.
 
Fields inherited from class com.sun.tools.doclets.internal.toolkit.builders.AbstractBuilder
configuration, containingPackagesSeen, DEBUG
 
Constructor Summary
private ConstantsSummaryBuilder(Configuration configuration)
          Construct a new ConstantsSummaryBuilder.
 
Method Summary
 void build()
          Build the documentation.
 void buildClassConstantSummary(java.util.List<?> elements)
          Build the summary for the current class.
 void buildClassFooter()
          Build the footer for the given class.
 void buildClassHeader()
          Build the header for the given class.
 void buildConstantMembers()
          Print summary of constant members in the class.
 void buildConstantSummaries(java.util.List<?> elements)
          Build the summary for each documented package.
 void buildConstantSummary(java.util.List<?> elements)
          Build the constant summary.
 void buildContents()
          Build the table of contents.
 void buildFooter()
          Build the footer.
 void buildHeader()
          Build the header.
 void buildPackageConstantSummary(java.util.List<?> elements)
          Build the summary for the current package.
 void buildPackageHeader()
          Build the header for the given class.
static ConstantsSummaryBuilder getInstance(Configuration configuration, ConstantsSummaryWriter writer)
          Construct a ConstantsSummaryBuilder.
 java.lang.String getName()
          Return the name of this builder.
private  boolean hasConstantField(ClassDoc classDoc)
          Return true if the given class has constant fields to document.
private  boolean hasConstantField(PackageDoc pkg)
          Return true if the given package has constant fields to document.
private  boolean hasPrintedPackageIndex(java.lang.String pkgname)
          Return true if the given package name has been printed.
 void invokeMethod(java.lang.String methodName, java.lang.Class<?>[] paramClasses, java.lang.Object[] params)
          Given the name and parameters, invoke the method in the builder.
private  java.lang.String parsePackageName(java.lang.String pkgname)
          Parse the package name.
 
Methods inherited from class com.sun.tools.doclets.internal.toolkit.builders.AbstractBuilder
build
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ROOT

public static final java.lang.String ROOT
The root element of the constant summary XML is "ConstantSummary".

See Also:
Constant Field Values

MAX_CONSTANT_VALUE_INDEX_LENGTH

public static final int MAX_CONSTANT_VALUE_INDEX_LENGTH
The maximum number of package directories shown in the constant value index.

See Also:
Constant Field Values

writer

protected ConstantsSummaryWriter writer
The writer used to write the results.


classDocsWithConstFields

protected java.util.Set<ClassDoc> classDocsWithConstFields
The set of ClassDocs that have constant fields.


printedPackageHeaders

protected java.util.Set<java.lang.String> printedPackageHeaders
The set of printed package headers.


currentPackage

private PackageDoc currentPackage
The current package being documented.


currentClass

private ClassDoc currentClass
The current class being documented.

Constructor Detail

ConstantsSummaryBuilder

private ConstantsSummaryBuilder(Configuration configuration)
Construct a new ConstantsSummaryBuilder.

Parameters:
configuration - the current configuration of the doclet.
Method Detail

getInstance

public static ConstantsSummaryBuilder getInstance(Configuration configuration,
                                                  ConstantsSummaryWriter writer)
Construct a ConstantsSummaryBuilder.

Parameters:
configuration - the configuration used in this run of the doclet.
writer - the writer for the summary.

invokeMethod

public void invokeMethod(java.lang.String methodName,
                         java.lang.Class<?>[] paramClasses,
                         java.lang.Object[] params)
                  throws java.lang.Exception
Given the name and parameters, invoke the method in the builder. This method is required to invoke the appropriate build method as instructed by the builder XML file.

Specified by:
invokeMethod in class AbstractBuilder
Parameters:
methodName - the name of the method that we would like to invoke.
paramClasses - the types for each parameter.
params - the parameters of the method.
Throws:
java.lang.Exception

build

public void build()
           throws java.io.IOException
Build the documentation.

Specified by:
build in class AbstractBuilder
Throws:
java.io.IOException - there was a problem writing the output.

getName

public java.lang.String getName()
Return the name of this builder.

Specified by:
getName in class AbstractBuilder
Returns:
the name of the builder.

buildConstantSummary

public void buildConstantSummary(java.util.List<?> elements)
                          throws java.lang.Exception
Build the constant summary.

Parameters:
elements - the list of elements describing constant summary documentation.
Throws:
java.lang.Exception

buildHeader

public void buildHeader()
Build the header.


buildFooter

public void buildFooter()
Build the footer.


buildContents

public void buildContents()
Build the table of contents.


buildConstantSummaries

public void buildConstantSummaries(java.util.List<?> elements)
Build the summary for each documented package.

Parameters:
elements - the XML elements that represent the components of documentation for each package.

buildPackageConstantSummary

public void buildPackageConstantSummary(java.util.List<?> elements)
Build the summary for the current package.

Parameters:
elements - the list of XML elements that make up package documentation.

buildClassConstantSummary

public void buildClassConstantSummary(java.util.List<?> elements)
Build the summary for the current class.

Parameters:
elements - the list of XML elements that make up the class constant summary.

buildPackageHeader

public void buildPackageHeader()
Build the header for the given class.


buildClassHeader

public void buildClassHeader()
Build the header for the given class.


buildConstantMembers

public void buildConstantMembers()
Print summary of constant members in the class.


buildClassFooter

public void buildClassFooter()
Build the footer for the given class.


hasConstantField

private boolean hasConstantField(PackageDoc pkg)
Return true if the given package has constant fields to document.

Parameters:
pkg - the package being checked.
Returns:
true if the given package has constant fields to document.

hasConstantField

private boolean hasConstantField(ClassDoc classDoc)
Return true if the given class has constant fields to document.

Parameters:
classDoc - the class being checked.
Returns:
true if the given package has constant fields to document.

hasPrintedPackageIndex

private boolean hasPrintedPackageIndex(java.lang.String pkgname)
Return true if the given package name has been printed. Also return true if the root of this package has been printed.

Parameters:
pkgname - the name of the package to check.

parsePackageName

private java.lang.String parsePackageName(java.lang.String pkgname)
Parse the package name. We only want to display package name up to 2 levels.