| 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.javadoc.Doclet
net.sf.fikin.doclets.AbstractDoclet
public abstract class AbstractDoclet
It was designed in order to help develop on top of original Sun's design
It does following thinks:
startCustom(RootDoc) or printUsage(DocErrorReporter)
 respectivelystartCustom(RootDoc) and 
 validateOptionsCustom()Eamples: A minimalistic custom doclet
      public class TestDoclet extends AbstractDoclet {
      
          // set the singleton to this one
          static {
              setSingleton( new TestDoclet() );
          }
      
          public TestDoclet() {
              // add here your own Doclet options
              docletOptions.addOption( "file",true,"destination file to be generated");
              ...
          }
          
          // following you have to do because static methods does not have inheritance
          public static int optionLength(String option) {
              return AbstractDoclet.optionLength( option );
          }
          
          // implement commandline options validation
          // to ensure mandatory options have been specified
          protected boolean validateOptionsCustom() {
              if ( ! parsedDocletOptions.hasOption( "template" ) ) {
                  return false;
              }
          }
          
          // implement your actual doclet logic
          protected boolean startCustom(RootDoc root) {
              ...
          }
            
      }
 
 
 created on Aug 9, 2006
| Field Summary | |
|---|---|
protected  org.apache.commons.cli.Options | 
docletOptions
supported doclet options, subclasses are supposed to add their specific options (if any)  | 
protected  org.apache.commons.cli.CommandLine | 
parsedDocletOptions
parsed doclet options passed to the doclet  | 
protected static AbstractDoclet | 
singleton
singleton instance of this doclet, all static calls are delegated to this one object subclasses are responsible to assign a valid instance during construction time  | 
| Constructor Summary | |
|---|---|
AbstractDoclet()
define Doclet's common options  | 
|
| Method Summary | |
|---|---|
static int | 
optionLength(java.lang.String option)
determine supported options length by delegating it to prototypedOptionLength(String)
 
 Expects the singleton to be assigned already. | 
protected  boolean | 
parseOptions(java.lang.String[][] options)
parse dolet's parameters parsing is based on Apache's Commons CLI BasicParser and uses the options defined in docletOptions. | 
protected  void | 
printUsage(com.sun.javadoc.DocErrorReporter reporter)
print javadoc usage, in this case it is predefined -d and -f options  | 
 int | 
prototypedOptionLength(java.lang.String option)
prototype method test the given option's length against options defined by docletOptions | 
 boolean | 
prototypedStart(com.sun.javadoc.RootDoc root)
prototype method parses the options via parseOptions(String[][]) and if that 
 part is ok then validates them via validateOptionsCustom()
 and if that also part is ok then executes startCustom(RootDoc) | 
 boolean | 
prototypedValidOptions(java.lang.String[][] options,
                       com.sun.javadoc.DocErrorReporter reporter)
prototype method.  | 
protected static void | 
setSingleton(AbstractDoclet doclet)
assign the singleton refernce to given doclet object this is method is to be called by the subclass "static" constructor  | 
static boolean | 
start(com.sun.javadoc.RootDoc root)
Generate output file by delegating it to prototypedStart(RootDoc)
 
 Expects the singleton to be assigned already. | 
protected abstract  boolean | 
startCustom(com.sun.javadoc.RootDoc root)
subclass specific method provides actual doclet's business logic once actual start(RootDoc) logic only instance dependant
 to be implented by the subclass | 
protected abstract  boolean | 
validateOptionsCustom()
subclass specific method provides with subclass secific validation for command line options (common ones have been taken care by AbstractDoclet already) check that parsedDocletOptions are valid i.e. | 
static boolean | 
validOptions(java.lang.String[][] options,
             com.sun.javadoc.DocErrorReporter reporter)
validate options by delegating it to prototypedValidOptions(String[][],DocErrorReporter)
 
 Expects the singleton to be assigned already. | 
| Methods inherited from class com.sun.javadoc.Doclet | 
|---|
languageVersion | 
| Methods inherited from class java.lang.Object | 
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
|---|
protected org.apache.commons.cli.Options docletOptions
protected org.apache.commons.cli.CommandLine parsedDocletOptions
protected static AbstractDoclet singleton
| Constructor Detail | 
|---|
public AbstractDoclet()
| Method Detail | 
|---|
public static boolean start(com.sun.javadoc.RootDoc root)
prototypedStart(RootDoc)
 
 Expects the singleton to be assigned already.
public static boolean validOptions(java.lang.String[][] options,
                                   com.sun.javadoc.DocErrorReporter reporter)
prototypedValidOptions(String[][],DocErrorReporter)
 
 Expects the singleton to be assigned already.
public static int optionLength(java.lang.String option)
prototypedOptionLength(String)
 
 Expects the singleton to be assigned already.
public boolean prototypedStart(com.sun.javadoc.RootDoc root)
parseOptions(String[][]) and if that 
 part is ok then validates them via validateOptionsCustom()
 and if that also part is ok then executes startCustom(RootDoc)
public int prototypedOptionLength(java.lang.String option)
docletOptions
option - to check
public boolean prototypedValidOptions(java.lang.String[][] options,
                                      com.sun.javadoc.DocErrorReporter reporter)
parseOptions(String[][]) and if that 
 part is ok then validates them via validateOptionsCustom().
 
 prints usage via printUsage(DocErrorReporter) if some of the
 checks failed.
protected static void setSingleton(AbstractDoclet doclet)
doclet - is an instance of the concrete subclassprotected boolean parseOptions(java.lang.String[][] options)
docletOptions.
options - 
protected void printUsage(com.sun.javadoc.DocErrorReporter reporter)
protected abstract boolean startCustom(com.sun.javadoc.RootDoc root)
start(RootDoc) logic only instance dependant
 to be implented by the subclass
root - 
protected abstract boolean validateOptionsCustom()
parsedDocletOptions are valid i.e. mandatory
 options are present and etc.
  | 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||