1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/share/classes/com/sun/javadoc/Doclet.java Sat Dec 01 00:00:00 2007 +0000 1.3 @@ -0,0 +1,111 @@ 1.4 +/* 1.5 + * Copyright 1997-2003 Sun Microsystems, Inc. All Rights Reserved. 1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 + * 1.8 + * This code is free software; you can redistribute it and/or modify it 1.9 + * under the terms of the GNU General Public License version 2 only, as 1.10 + * published by the Free Software Foundation. Sun designates this 1.11 + * particular file as subject to the "Classpath" exception as provided 1.12 + * by Sun in the LICENSE file that accompanied this code. 1.13 + * 1.14 + * This code is distributed in the hope that it will be useful, but WITHOUT 1.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.17 + * version 2 for more details (a copy is included in the LICENSE file that 1.18 + * accompanied this code). 1.19 + * 1.20 + * You should have received a copy of the GNU General Public License version 1.21 + * 2 along with this work; if not, write to the Free Software Foundation, 1.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.23 + * 1.24 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 1.25 + * CA 95054 USA or visit www.sun.com if you need additional information or 1.26 + * have any questions. 1.27 + */ 1.28 + 1.29 +package com.sun.javadoc; 1.30 + 1.31 +/** 1.32 + * This is an example of a starting class for a doclet, 1.33 + * showing the entry-point methods. A starting class must 1.34 + * import com.sun.javadoc.* and implement the 1.35 + * <code>start(RootDoc)</code> method, as described in the 1.36 + * <a href="package-summary.html#package_description">package 1.37 + * description</a>. If the doclet takes command line options, 1.38 + * it must also implement <code>optionLength</code> and 1.39 + * <code>validOptions</code>. 1.40 + * 1.41 + * <p> A doclet supporting the language features added since 1.1 1.42 + * (such as generics and annotations) should indicate this 1.43 + * by implementing <code>languageVersion</code>. In the absence of 1.44 + * this the doclet should not invoke any of the Doclet API methods 1.45 + * added since 1.5, and 1.46 + * the results of several other methods are modified so as 1.47 + * to conceal the new constructs (such as type parameters) from 1.48 + * the doclet. 1.49 + * 1.50 + * <p> To start the doclet, pass 1.51 + * <code>-doclet</code> followed by the fully-qualified 1.52 + * name of the starting class on the javadoc tool command line. 1.53 + */ 1.54 +public abstract class Doclet { 1.55 + 1.56 + /** 1.57 + * Generate documentation here. 1.58 + * This method is required for all doclets. 1.59 + * 1.60 + * @return true on success. 1.61 + */ 1.62 + public static boolean start(RootDoc root) { 1.63 + return true; 1.64 + } 1.65 + 1.66 + /** 1.67 + * Check for doclet-added options. Returns the number of 1.68 + * arguments you must specify on the command line for the 1.69 + * given option. For example, "-d docs" would return 2. 1.70 + * <P> 1.71 + * This method is required if the doclet contains any options. 1.72 + * If this method is missing, Javadoc will print an invalid flag 1.73 + * error for every option. 1.74 + * 1.75 + * @return number of arguments on the command line for an option 1.76 + * including the option name itself. Zero return means 1.77 + * option not known. Negative value means error occurred. 1.78 + */ 1.79 + public static int optionLength(String option) { 1.80 + return 0; // default is option unknown 1.81 + } 1.82 + 1.83 + /** 1.84 + * Check that options have the correct arguments. 1.85 + * <P> 1.86 + * This method is not required, but is recommended, 1.87 + * as every option will be considered valid if this method 1.88 + * is not present. It will default gracefully (to true) 1.89 + * if absent. 1.90 + * <P> 1.91 + * Printing option related error messages (using the provided 1.92 + * DocErrorReporter) is the responsibility of this method. 1.93 + * 1.94 + * @return true if the options are valid. 1.95 + */ 1.96 + public static boolean validOptions(String options[][], 1.97 + DocErrorReporter reporter) { 1.98 + return true; // default is options are valid 1.99 + } 1.100 + 1.101 + /** 1.102 + * Return the version of the Java Programming Language supported 1.103 + * by this doclet. 1.104 + * <p> 1.105 + * This method is required by any doclet supporting a language version 1.106 + * newer than 1.1. 1.107 + * 1.108 + * @return the language version supported by this doclet. 1.109 + * @since 1.5 1.110 + */ 1.111 + public static LanguageVersion languageVersion() { 1.112 + return LanguageVersion.JAVA_1_1; 1.113 + } 1.114 +}