KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > javadoc > Doclet


1 /*
2  * @(#)Doclet.java 1.15 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package com.sun.javadoc;
9
10 /**
11  * This is an example of a starting class for a doclet,
12  * showing the entry-point methods. A starting class must
13  * import com.sun.javadoc.* and implement the
14  * <code>start(RootDoc)</code> method, as described in the
15  * <a HREF="package-summary.html#package_description">package
16  * description</a>. If the doclet takes command line options,
17  * it must also implement <code>optionLength</code> and
18  * <code>validOptions</code>.
19  *
20  * <p> A doclet supporting the language features added since 1.1
21  * (such as generics and annotations) should indicate this
22  * by implementing <code>languageVersion</code>. In the absence of
23  * this the doclet should not invoke any of the Doclet API methods
24  * added since 1.5, and
25  * the results of several other methods are modified so as
26  * to conceal the new constructs (such as type parameters) from
27  * the doclet.
28  *
29  * <p> To start the doclet, pass
30  * <code>-doclet</code> followed by the fully-qualified
31  * name of the starting class on the javadoc tool command line.
32  */

33 public abstract class Doclet {
34
35     /**
36      * Generate documentation here.
37      * This method is required for all doclets.
38      *
39      * @return true on success.
40      */

41     public static boolean start(RootDoc root) {
42         return true;
43     }
44
45     /**
46      * Check for doclet-added options. Returns the number of
47      * arguments you must specify on the command line for the
48      * given option. For example, "-d docs" would return 2.
49      * <P>
50      * This method is required if the doclet contains any options.
51      * If this method is missing, Javadoc will print an invalid flag
52      * error for every option.
53      *
54      * @return number of arguments on the command line for an option
55      * including the option name itself. Zero return means
56      * option not known. Negative value means error occurred.
57      */

58     public static int optionLength(String JavaDoc option) {
59         return 0; // default is option unknown
60
}
61
62     /**
63      * Check that options have the correct arguments.
64      * <P>
65      * This method is not required, but is recommended,
66      * as every option will be considered valid if this method
67      * is not present. It will default gracefully (to true)
68      * if absent.
69      * <P>
70      * Printing option related error messages (using the provided
71      * DocErrorReporter) is the responsibility of this method.
72      *
73      * @return true if the options are valid.
74      */

75     public static boolean validOptions(String JavaDoc options[][],
76                                        DocErrorReporter reporter) {
77         return true; // default is options are valid
78
}
79
80     /**
81      * Return the version of the Java Programming Language supported
82      * by this doclet.
83      * <p>
84      * This method is required by any doclet supporting a language version
85      * newer than 1.1.
86      *
87      * @return the language version supported by this doclet.
88      * @since 1.5
89      */

90     public static LanguageVersion languageVersion() {
91     return LanguageVersion.JAVA_1_1;
92     }
93 }
94
95
Popular Tags