Doclet.java revision 2571:10fc81ac75b4
1250199Sgrehan/*
2298446Ssephe * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
3250199Sgrehan * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4250199Sgrehan *
5250199Sgrehan * This code is free software; you can redistribute it and/or modify it
6250199Sgrehan * under the terms of the GNU General Public License version 2 only, as
7250199Sgrehan * published by the Free Software Foundation.  Oracle designates this
8250199Sgrehan * particular file as subject to the "Classpath" exception as provided
9250199Sgrehan * by Oracle in the LICENSE file that accompanied this code.
10250199Sgrehan *
11250199Sgrehan * This code is distributed in the hope that it will be useful, but WITHOUT
12250199Sgrehan * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13250199Sgrehan * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14250199Sgrehan * version 2 for more details (a copy is included in the LICENSE file that
15250199Sgrehan * accompanied this code).
16250199Sgrehan *
17250199Sgrehan * You should have received a copy of the GNU General Public License version
18250199Sgrehan * 2 along with this work; if not, write to the Free Software Foundation,
19250199Sgrehan * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20250199Sgrehan *
21250199Sgrehan * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22250199Sgrehan * or visit www.oracle.com if you need additional information or have any
23250199Sgrehan * questions.
24250199Sgrehan */
25250199Sgrehan
26250199Sgrehanpackage com.sun.javadoc;
27250199Sgrehan
28250199Sgrehan/**
29256276Sdim * This is an example of a starting class for a doclet,
30256276Sdim * showing the entry-point methods.  A starting class must
31256276Sdim * import com.sun.javadoc.* and implement the
32250199Sgrehan * {@code start(RootDoc)} method, as described in the
33296028Ssephe * <a href="package-summary.html#package_description">package
34250199Sgrehan * description</a>.  If the doclet takes command line options,
35250199Sgrehan * it must also implement {@code optionLength} and
36250199Sgrehan * {@code validOptions}.
37250199Sgrehan *
38250199Sgrehan * <p> A doclet supporting the language features added since 1.1
39296181Ssephe * (such as generics and annotations) should indicate this
40301588Ssephe * by implementing {@code languageVersion}.  In the absence of
41301588Ssephe * this the doclet should not invoke any of the Doclet API methods
42250199Sgrehan * added since 1.5, and
43301588Ssephe * the results of several other methods are modified so as
44250199Sgrehan * to conceal the new constructs (such as type parameters) from
45250199Sgrehan * the doclet.
46250199Sgrehan *
47250199Sgrehan * <p> To start the doclet, pass
48300102Ssephe * {@code -doclet} followed by the fully-qualified
49302619Ssephe * name of the starting class on the javadoc tool command line.
50301588Ssephe */
51300102Ssephepublic abstract class Doclet {
52250199Sgrehan
53302731Ssephe    /**
54302692Ssephe     * Generate documentation here.
55302692Ssephe     * This method is required for all doclets.
56302864Ssephe     *
57302713Ssephe     * @param root Supply the RootDoc to the method.
58302713Ssephe     * @return true on success.
59302864Ssephe     */
60250199Sgrehan    public static boolean start(RootDoc root) {
61302864Ssephe        return true;
62302864Ssephe    }
63302864Ssephe
64302864Ssephe    /**
65302864Ssephe     * Check for doclet-added options.  Returns the number of
66302864Ssephe     * arguments you must specify on the command line for the
67302864Ssephe     * given option.  For example, "-d docs" would return 2.
68302864Ssephe     * <P>
69302864Ssephe     * This method is required if the doclet contains any options.
70302864Ssephe     * If this method is missing, Javadoc will print an invalid flag
71302864Ssephe     * error for every option.
72302864Ssephe     *
73302864Ssephe     * @param option the option for which the number of arguements is returned.
74302864Ssephe     * @return number of arguments on the command line for an option
75302864Ssephe     *         including the option name itself.  Zero return means
76302864Ssephe     *         option not known.  Negative value means error occurred.
77302864Ssephe     */
78302864Ssephe    public static int optionLength(String option) {
79250199Sgrehan        return 0;  // default is option unknown
80250199Sgrehan    }
81250199Sgrehan
82250199Sgrehan    /**
83302731Ssephe     * Check that options have the correct arguments.
84250199Sgrehan     * <P>
85302618Ssephe     * This method is not required, but is recommended,
86302693Ssephe     * as every option will be considered valid if this method
87302618Ssephe     * is not present.  It will default gracefully (to true)
88302618Ssephe     * if absent.
89302618Ssephe     * <P>
90302618Ssephe     * Printing option related error messages (using the provided
91302695Ssephe     * DocErrorReporter) is the responsibility of this method.
92302731Ssephe     *
93302731Ssephe     * @param options Supply valid options as an array of Strings.
94302731Ssephe     * @param reporter The DocErrorReporter responsible for these options.
95250199Sgrehan     * @return true if the options are valid.
96302726Ssephe     */
97250199Sgrehan    public static boolean validOptions(String options[][],
98250199Sgrehan                                       DocErrorReporter reporter) {
99250199Sgrehan        return true;  // default is options are valid
100296289Ssephe    }
101296289Ssephe
102296289Ssephe    /**
103296289Ssephe     * Return the version of the Java Programming Language supported
104296289Ssephe     * by this doclet.
105296289Ssephe     * <p>
106302695Ssephe     * This method is required by any doclet supporting a language version
107296289Ssephe     * newer than 1.1.
108296289Ssephe     *
109296289Ssephe     * @return  the language version supported by this doclet.
110296289Ssephe     * @since 1.5
111296181Ssephe     */
112296290Ssephe    public static LanguageVersion languageVersion() {
113296181Ssephe        return LanguageVersion.JAVA_1_1;
114296181Ssephe    }
115296181Ssephe}
116296181Ssephe