de.kruis.padoclet
Class FilterDocletBase

java.lang.Object
  extended by de.kruis.padoclet.FilterDocletBase
All Implemented Interfaces:
HalfDynamicProxy.MessageInterface
Direct Known Subclasses:
PublishedApiDoclet

public class FilterDocletBase
extends java.lang.Object
implements HalfDynamicProxy.MessageInterface

This class is a base class for javadoc filter doclets. A filter doclet is plugged between the javadoc core and a second doclet, that is used to create the output. The filter doclet modifies the information about the java code to be documented. It can hide java items (as done by the PublishedApiDoclet) or change the information in any other way.

This class is not a doclet by itself. It is intended as a base class for a doclet. The derived class has to implement the static methods required by a doclet and to setup the options (FilterDocletBase.Option.register(AbstractOption)) and the proxy table (HalfDynamicProxy.setProxyClassTable(Class[][])). See PublishedApiDoclet for an example.


Nested Class Summary
static class FilterDocletBase.ComparableHandler
          This class is the base of all the HalfDynamicProxy classes for the javadoc *Doc interfaces.
private static class FilterDocletBase.DH
          This class is used to perform a lazy instantiation of the delegate / formating doclet class.
static class FilterDocletBase.HandlerBase
          This class is the base of all the HalfDynamicProxy classes for the javadoc interfaces.
protected static class FilterDocletBase.Option
          Option handling for doclets.
 
Field Summary
private  com.sun.javadoc.DocErrorReporter errorReporter
          holds the error reporter provided by the javadoc core
static java.lang.String PAD_DELEGATE_DOCLET_SYSTEM_PROPERTY
          The name of the system property, that contains the name of the delegate doclet.
 
Fields inherited from interface de.kruis.padoclet.util.HalfDynamicProxy.MessageInterface
PRIORITY_DEBUG, PRIORITY_ERROR, PRIORITY_WARN
 
Constructor Summary
protected FilterDocletBase()
          Create a new FilterDocletBase instance.
 
Method Summary
private static java.lang.Object delegateDocletInvoke(java.lang.String name, java.lang.Object[] par)
          Invoke a static method on the delegate doclet.
 void emitMessage(java.lang.String theMessage, int priority)
           
protected static java.lang.String[][] filterOptions(java.lang.String[][] options)
          Filter the command line options seen by the formating Doclet.
 com.sun.javadoc.DocErrorReporter getErrorReporter()
           
protected static com.sun.javadoc.LanguageVersion languageVersionHelper()
          Helper method used to implement the doclet languageVersion method.
protected static int optionLengthHelper(java.lang.String option, java.lang.String className)
          Helper method used to implement the doclet optionLength method.
protected  void preDelegateStartHook(com.sun.javadoc.RootDoc filteredRootDoc)
          Hook method called prior to the start-method of the delegate doclet.
 void setErrorReporter(com.sun.javadoc.DocErrorReporter errorReporter)
           
protected static boolean startHelper(com.sun.javadoc.RootDoc root, FilterDocletBase fd)
          Helper method used to implement the doclet start method.
protected static boolean validOptionsHelper(java.lang.String[][] options, com.sun.javadoc.DocErrorReporter reporter, boolean showHelp, java.lang.String className)
          Helper method to ease the implementation of the doclet validOptions method.
 

Field Detail

PAD_DELEGATE_DOCLET_SYSTEM_PROPERTY

public static final java.lang.String PAD_DELEGATE_DOCLET_SYSTEM_PROPERTY
The name of the system property, that contains the name of the delegate doclet. If this system property is unset, the default doclet (com.sun.tools.doclets.standard.Standard) is used.

See Also:
Constant Field Values

errorReporter

private com.sun.javadoc.DocErrorReporter errorReporter
holds the error reporter provided by the javadoc core

Constructor Detail

FilterDocletBase

protected FilterDocletBase()
Create a new FilterDocletBase instance. This constructor is protected, because this constructor is intended to be called by subclasses only.

Method Detail

getErrorReporter

public final com.sun.javadoc.DocErrorReporter getErrorReporter()
Returns:
Returns the errorReporter provided by the doclet core.

setErrorReporter

public final void setErrorReporter(com.sun.javadoc.DocErrorReporter errorReporter)
Parameters:
errorReporter - The errorReporter to set.

emitMessage

public void emitMessage(java.lang.String theMessage,
                        int priority)
Specified by:
emitMessage in interface HalfDynamicProxy.MessageInterface

delegateDocletInvoke

private static java.lang.Object delegateDocletInvoke(java.lang.String name,
                                                     java.lang.Object[] par)
Invoke a static method on the delegate doclet. This method performs a few security checks.

Parameters:
name - name of the method to be invoked
par - an array, that contains the method parameters
Returns:
the return value of the invoked method.

filterOptions

protected static java.lang.String[][] filterOptions(java.lang.String[][] options)
Filter the command line options seen by the formating Doclet. Remove the options, that are processed by the filter doclet and add options to suppress warnings about unknown tags.

Parameters:
options - the options as provided by the javadoc core
Returns:
the filtered options
See Also:
Doclet.validOptions(java.lang.String[][], com.sun.javadoc.DocErrorReporter), RootDoc.options()

validOptionsHelper

protected static boolean validOptionsHelper(java.lang.String[][] options,
                                            com.sun.javadoc.DocErrorReporter reporter,
                                            boolean showHelp,
                                            java.lang.String className)
                                     throws java.io.IOException
Helper method to ease the implementation of the doclet validOptions method. This method provides all you need in order to implement Doclet.validOptions(java.lang.String[][], com.sun.javadoc.DocErrorReporter).

Parameters:
options - the options
reporter - the errorReporter
showHelp - if true, the method will show an online help message and return false.
className - the name of the filter doclet
Returns:
true, if all options are valid. Otherwise show a help message and return false.
Throws:
java.io.IOException
See Also:
Doclet.validOptions(java.lang.String[][], com.sun.javadoc.DocErrorReporter)

optionLengthHelper

protected static int optionLengthHelper(java.lang.String option,
                                        java.lang.String className)
Helper method used to implement the doclet optionLength method.

Parameters:
option - the name of the option
className - the name of the filter doclet
Returns:
the length of the option
See Also:
Doclet.optionLength(java.lang.String)

languageVersionHelper

protected static com.sun.javadoc.LanguageVersion languageVersionHelper()
Helper method used to implement the doclet languageVersion method. See PublishedApiDoclet.languageVersion() for an example on how to use this method.

Returns:
the language version supported by the delegate doclet.

startHelper

protected static boolean startHelper(com.sun.javadoc.RootDoc root,
                                     FilterDocletBase fd)
                              throws java.io.IOException
Helper method used to implement the doclet start method. See PublishedApiDoclet.start(RootDoc) for an example on how to use this method.

Parameters:
root - the RootDoc object as provided by the javadoc core.
fd - a newly created filter doclet object
Returns:
see Doclet.start(com.sun.javadoc.RootDoc).
Throws:
java.io.IOException

preDelegateStartHook

protected void preDelegateStartHook(com.sun.javadoc.RootDoc filteredRootDoc)
Hook method called prior to the start-method of the delegate doclet. This implementation is an empty method, that does nothing. Override this method, if you want to perform any operations within this hook.

Parameters:
filteredRootDoc - the filtered RootDoc.