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. package com.sun.javadoc;
  8. /**
  9. * This is an example of a starting class for a doclet,
  10. * showing the entry-point methods. A starting class must
  11. * import com.sun.javadoc.* and implement the
  12. * <code>start(RootDoc)</code> method, as described in the
  13. * <a href="package-summary.html#package_description">package
  14. * description</a>. If the doclet takes command line options,
  15. * it must also implement <code>optionLength</code> and
  16. * <code>validOptions</code>.
  17. *
  18. * <p> A doclet supporting the language features added since 1.1
  19. * (such as generics and annotations) should indicate this
  20. * by implementing <code>languageVersion</code>. In the absence of
  21. * this the doclet should not invoke any of the Doclet API methods
  22. * added since 1.5, and
  23. * the results of several other methods are modified so as
  24. * to conceal the new constructs (such as type parameters) from
  25. * the doclet.
  26. *
  27. * <p> To start the doclet, pass
  28. * <code>-doclet</code> followed by the fully-qualified
  29. * name of the starting class on the javadoc tool command line.
  30. */
  31. public abstract class Doclet {
  32. /**
  33. * Generate documentation here.
  34. * This method is required for all doclets.
  35. *
  36. * @return true on success.
  37. */
  38. public static boolean start(RootDoc root) {
  39. return true;
  40. }
  41. /**
  42. * Check for doclet-added options. Returns the number of
  43. * arguments you must specify on the command line for the
  44. * given option. For example, "-d docs" would return 2.
  45. * <P>
  46. * This method is required if the doclet contains any options.
  47. * If this method is missing, Javadoc will print an invalid flag
  48. * error for every option.
  49. *
  50. * @return number of arguments on the command line for an option
  51. * including the option name itself. Zero return means
  52. * option not known. Negative value means error occurred.
  53. */
  54. public static int optionLength(String option) {
  55. return 0; // default is option unknown
  56. }
  57. /**
  58. * Check that options have the correct arguments.
  59. * <P>
  60. * This method is not required, but is recommended,
  61. * as every option will be considered valid if this method
  62. * is not present. It will default gracefully (to true)
  63. * if absent.
  64. * <P>
  65. * Printing option related error messages (using the provided
  66. * DocErrorReporter) is the responsibility of this method.
  67. *
  68. * @return true if the options are valid.
  69. */
  70. public static boolean validOptions(String options[][],
  71. DocErrorReporter reporter) {
  72. return true; // default is options are valid
  73. }
  74. /**
  75. * Return the version of the Java Programming Language supported
  76. * by this doclet.
  77. * <p>
  78. * This method is required by any doclet supporting a language version
  79. * newer than 1.1.
  80. *
  81. * @return the language version supported by this doclet.
  82. * @since 1.5
  83. */
  84. public static LanguageVersion languageVersion() {
  85. return LanguageVersion.JAVA_1_1;
  86. }
  87. }