Class Doclet

java.lang.Object
jdk.javadoc.doclet.StandardDoclet
org.apache.sis.internal.doclet.Doclet
All Implemented Interfaces:
jdk.javadoc.doclet.Doclet

public final class Doclet extends jdk.javadoc.doclet.StandardDoclet
A doclet which delegates the work to the standard doclet, then performs additional actions. The post-javadoc actions are:
  • Copy additional resources.
Since:
0.5
Version:
1.2
  • Nested Class Summary

    Nested classes/interfaces inherited from interface jdk.javadoc.doclet.Doclet

    jdk.javadoc.doclet.Doclet.Option
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private String
    The directory where HTML pages will be written.
    private static final String
    The name of the SIS-specific stylesheet file.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Invoked by the Javadoc tools for instantiating the custom doclet.
  • Method Summary

    Modifier and Type
    Method
    Description
    private static void
    copyResources(Path inputDirectory, Path outputDirectory)
    Creates links to Javadoc resources in the top-level directory (not from "doc-files" subdirectories).
    private void
    Reports an I/O errors.
    Returns a name identifying this doclet.
    Set<jdk.javadoc.doclet.Doclet.Option>
    Returns the options supported by the standard doclet.
    private static Path
    resources(Path directory)
    Returns the src/main/javadoc/ directory relative to the root of the Maven project.
    boolean
    run(jdk.javadoc.doclet.DocletEnvironment environment)
    Invoked by Javadoc for starting the doclet.

    Methods inherited from class jdk.javadoc.doclet.StandardDoclet

    getLocale, getReporter, getSupportedSourceVersion, init

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • STYLESHEET

      private static final String STYLESHEET
      The name of the SIS-specific stylesheet file.
      See Also:
    • outputDirectory

      private String outputDirectory
      The directory where HTML pages will be written.
  • Constructor Details

    • Doclet

      public Doclet()
      Invoked by the Javadoc tools for instantiating the custom doclet.
  • Method Details

    • getSupportedOptions

      public Set<jdk.javadoc.doclet.Doclet.Option> getSupportedOptions()
      Returns the options supported by the standard doclet.
      Specified by:
      getSupportedOptions in interface jdk.javadoc.doclet.Doclet
      Overrides:
      getSupportedOptions in class jdk.javadoc.doclet.StandardDoclet
      Returns:
      all the supported options.
    • getName

      public String getName()
      Returns a name identifying this doclet.
      Specified by:
      getName in interface jdk.javadoc.doclet.Doclet
      Overrides:
      getName in class jdk.javadoc.doclet.StandardDoclet
      Returns:
      "ApacheSIS".
    • run

      public boolean run(jdk.javadoc.doclet.DocletEnvironment environment)
      Invoked by Javadoc for starting the doclet.
      Specified by:
      run in interface jdk.javadoc.doclet.Doclet
      Overrides:
      run in class jdk.javadoc.doclet.StandardDoclet
      Parameters:
      environment - the Javadoc environment.
      Returns:
      true on success, or false on failure.
    • resources

      private static Path resources(Path directory) throws FileNotFoundException
      Returns the src/main/javadoc/ directory relative to the root of the Maven project. This method scans parents of the given directory until we find the root of the Maven project.
      Throws:
      FileNotFoundException
    • copyResources

      private static void copyResources(Path inputDirectory, Path outputDirectory) throws IOException
      Creates links to Javadoc resources in the top-level directory (not from "doc-files" subdirectories). While the Maven documentation said that the "src/main/javadoc" directory is copied by default, or a directory can be specified with <javadocResourcesDirectory>, I have been unable to make it work even with absolute paths.
      Parameters:
      inputFile - the directory containing resources.
      outputDirectory - the directory where to copy the resource files.
      Throws:
      IOException - if an error occurred while reading or writing.
    • error

      private void error(IOException e)
      Reports an I/O errors.