src/jdk.javadoc/share/classes/com/sun/javadoc/Doclet.java
changeset 47216 71c04702a3d5
parent 46081 7c6d73d10b6b
child 48840 5e2d2067da48
equal deleted inserted replaced
47215:4ebc2e2fb97c 47216:71c04702a3d5
       
     1 /*
       
     2  * Copyright (c) 1997, 2017, Oracle and/or its affiliates. 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.  Oracle designates this
       
     8  * particular file as subject to the "Classpath" exception as provided
       
     9  * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
       
    22  * or visit www.oracle.com if you need additional information or have any
       
    23  * 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)} 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} and
       
    36  * {@code validOptions}.
       
    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}.  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} followed by the fully-qualified
       
    49  * name of the starting class on the javadoc tool command line.
       
    50  *
       
    51  * @deprecated
       
    52  *   The declarations in this package have been superseded by those
       
    53  *   in the package {@code jdk.javadoc.doclet}.
       
    54  *   For more information, see the <i>Migration Guide</i> in the documentation for that package.
       
    55  */
       
    56 @Deprecated
       
    57 public abstract class Doclet {
       
    58 
       
    59     /**
       
    60      * Generate documentation here.
       
    61      * This method is required for all doclets.
       
    62      *
       
    63      * @param root Supply the RootDoc to the method.
       
    64      * @return true on success.
       
    65      */
       
    66     public static boolean start(RootDoc root) {
       
    67         return true;
       
    68     }
       
    69 
       
    70     /**
       
    71      * Check for doclet-added options.  Returns the number of
       
    72      * arguments you must specify on the command line for the
       
    73      * given option.  For example, "-d docs" would return 2.
       
    74      * <P>
       
    75      * This method is required if the doclet contains any options.
       
    76      * If this method is missing, Javadoc will print an invalid flag
       
    77      * error for every option.
       
    78      *
       
    79      * @param option the option for which the number of arguements is returned.
       
    80      * @return number of arguments on the command line for an option
       
    81      *         including the option name itself.  Zero return means
       
    82      *         option not known.  Negative value means error occurred.
       
    83      */
       
    84     public static int optionLength(String option) {
       
    85         return 0;  // default is option unknown
       
    86     }
       
    87 
       
    88     /**
       
    89      * Check that options have the correct arguments.
       
    90      * <P>
       
    91      * This method is not required, but is recommended,
       
    92      * as every option will be considered valid if this method
       
    93      * is not present.  It will default gracefully (to true)
       
    94      * if absent.
       
    95      * <P>
       
    96      * Printing option related error messages (using the provided
       
    97      * DocErrorReporter) is the responsibility of this method.
       
    98      *
       
    99      * @param options Supply valid options as an array of Strings.
       
   100      * @param reporter The DocErrorReporter responsible for these options.
       
   101      * @return true if the options are valid.
       
   102      */
       
   103     public static boolean validOptions(String options[][],
       
   104                                        DocErrorReporter reporter) {
       
   105         return true;  // default is options are valid
       
   106     }
       
   107 
       
   108     /**
       
   109      * Return the version of the Java Programming Language supported
       
   110      * by this doclet.
       
   111      * <p>
       
   112      * This method is required by any doclet supporting a language version
       
   113      * newer than 1.1.
       
   114      *
       
   115      * @return  the language version supported by this doclet.
       
   116      * @since 1.5
       
   117      */
       
   118     public static LanguageVersion languageVersion() {
       
   119         return LanguageVersion.JAVA_1_1;
       
   120     }
       
   121 }