langtools/src/share/classes/com/sun/javadoc/Doclet.java
changeset 10 06bc494ca11e
child 5520 86e4b9a9da40
equal deleted inserted replaced
0:fd16c54261b3 10:06bc494ca11e
       
     1 /*
       
     2  * Copyright 1997-2003 Sun Microsystems, Inc.  All Rights Reserved.
       
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       
     4  *
       
     5  * This code is free software; you can redistribute it and/or modify it
       
     6  * under the terms of the GNU General Public License version 2 only, as
       
     7  * published by the Free Software Foundation.  Sun designates this
       
     8  * particular file as subject to the "Classpath" exception as provided
       
     9  * by Sun in the LICENSE file that accompanied this code.
       
    10  *
       
    11  * This code is distributed in the hope that it will be useful, but WITHOUT
       
    12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
       
    13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
       
    14  * version 2 for more details (a copy is included in the LICENSE file that
       
    15  * accompanied this code).
       
    16  *
       
    17  * You should have received a copy of the GNU General Public License version
       
    18  * 2 along with this work; if not, write to the Free Software Foundation,
       
    19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
       
    20  *
       
    21  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
       
    22  * CA 95054 USA or visit www.sun.com if you need additional information or
       
    23  * have any questions.
       
    24  */
       
    25 
       
    26 package com.sun.javadoc;
       
    27 
       
    28 /**
       
    29  * This is an example of a starting class for a doclet,
       
    30  * showing the entry-point methods.  A starting class must
       
    31  * import com.sun.javadoc.* and implement the
       
    32  * <code>start(RootDoc)</code> method, as described in the
       
    33  * <a href="package-summary.html#package_description">package
       
    34  * description</a>.  If the doclet takes command line options,
       
    35  * it must also implement <code>optionLength</code> and
       
    36  * <code>validOptions</code>.
       
    37  *
       
    38  * <p> A doclet supporting the language features added since 1.1
       
    39  * (such as generics and annotations) should indicate this
       
    40  * by implementing <code>languageVersion</code>.  In the absence of
       
    41  * this the doclet should not invoke any of the Doclet API methods
       
    42  * added since 1.5, and
       
    43  * the results of several other methods are modified so as
       
    44  * to conceal the new constructs (such as type parameters) from
       
    45  * the doclet.
       
    46  *
       
    47  * <p> To start the doclet, pass
       
    48  * <code>-doclet</code> followed by the fully-qualified
       
    49  * name of the starting class on the javadoc tool command line.
       
    50  */
       
    51 public abstract class Doclet {
       
    52 
       
    53     /**
       
    54      * Generate documentation here.
       
    55      * This method is required for all doclets.
       
    56      *
       
    57      * @return true on success.
       
    58      */
       
    59     public static boolean start(RootDoc root) {
       
    60         return true;
       
    61     }
       
    62 
       
    63     /**
       
    64      * Check for doclet-added options.  Returns the number of
       
    65      * arguments you must specify on the command line for the
       
    66      * given option.  For example, "-d docs" would return 2.
       
    67      * <P>
       
    68      * This method is required if the doclet contains any options.
       
    69      * If this method is missing, Javadoc will print an invalid flag
       
    70      * error for every option.
       
    71      *
       
    72      * @return number of arguments on the command line for an option
       
    73      *         including the option name itself.  Zero return means
       
    74      *         option not known.  Negative value means error occurred.
       
    75      */
       
    76     public static int optionLength(String option) {
       
    77         return 0;  // default is option unknown
       
    78     }
       
    79 
       
    80     /**
       
    81      * Check that options have the correct arguments.
       
    82      * <P>
       
    83      * This method is not required, but is recommended,
       
    84      * as every option will be considered valid if this method
       
    85      * is not present.  It will default gracefully (to true)
       
    86      * if absent.
       
    87      * <P>
       
    88      * Printing option related error messages (using the provided
       
    89      * DocErrorReporter) is the responsibility of this method.
       
    90      *
       
    91      * @return true if the options are valid.
       
    92      */
       
    93     public static boolean validOptions(String options[][],
       
    94                                        DocErrorReporter reporter) {
       
    95         return true;  // default is options are valid
       
    96     }
       
    97 
       
    98     /**
       
    99      * Return the version of the Java Programming Language supported
       
   100      * by this doclet.
       
   101      * <p>
       
   102      * This method is required by any doclet supporting a language version
       
   103      * newer than 1.1.
       
   104      *
       
   105      * @return  the language version supported by this doclet.
       
   106      * @since 1.5
       
   107      */
       
   108     public static LanguageVersion languageVersion() {
       
   109         return LanguageVersion.JAVA_1_1;
       
   110     }
       
   111 }