Class Taglet

java.lang.Object
org.apache.sis.internal.doclet.Taglet
All Implemented Interfaces:
jdk.javadoc.doclet.Taglet
Direct Known Subclasses:
Include, Module, Preformat

abstract class Taglet extends Object implements jdk.javadoc.doclet.Taglet
Base class of all taglets implemented in this package. Taglets are assumed inline by default.
Since:
0.3
Version:
1.2
  • Nested Class Summary

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

    jdk.javadoc.doclet.Taglet.Location
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private Element
    The current element, or null if none.
    private jdk.javadoc.doclet.Reporter
    Where to report warnings, or null if unknown.
    private com.sun.source.util.DocTrees
    Utility methods for locating the path of elements, or null if unknown.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a default inline taglet.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected abstract void
    format(com.sun.source.doctree.DocTree tag, StringBuilder appendTo)
    Given a single DocTrees representing this custom tag, returns its string representation.
    Set<jdk.javadoc.doclet.Taglet.Location>
    Returns the set of locations in which this taglet may be used.
    protected final Path
    Returns the file that contains the current tag, or null if the method cannot determine the file.
    void
    init(jdk.javadoc.doclet.DocletEnvironment env, jdk.javadoc.doclet.Doclet doclet)
    Initializes this taglet with the given doclet environment and doclet.
    boolean
    Returns true by default since this base class is about inline tags.
    private void
    print(Diagnostic.Kind kind, String message)
    Prints an error or warning message.
    protected final void
    printError(String message)
    Prints an error message for the current tag.
    protected final void
    Prints a warning message for the current tag.
    (package private) static String
    text(com.sun.source.doctree.DocTree tag)
    Returns the text contained in the given inline tag.
    final String
    toString(List<? extends com.sun.source.doctree.DocTree> tags, Element element)
    Given a list of DocTrees representing this custom tag, returns its string representation.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface jdk.javadoc.doclet.Taglet

    getName, isBlockTag
  • Field Details

    • reporter

      private jdk.javadoc.doclet.Reporter reporter
      Where to report warnings, or null if unknown.
    • trees

      private com.sun.source.util.DocTrees trees
      Utility methods for locating the path of elements, or null if unknown.
    • element

      private Element element
      The current element, or null if none.
  • Constructor Details

    • Taglet

      Taglet()
      Constructs a default inline taglet.
  • Method Details

    • init

      public void init(jdk.javadoc.doclet.DocletEnvironment env, jdk.javadoc.doclet.Doclet doclet)
      Initializes this taglet with the given doclet environment and doclet.
      Specified by:
      init in interface jdk.javadoc.doclet.Taglet
      Parameters:
      env - the environment in which the taglet is running.
      doclet - the doclet that instantiated this taglet.
    • getAllowedLocations

      public Set<jdk.javadoc.doclet.Taglet.Location> getAllowedLocations()
      Returns the set of locations in which this taglet may be used. By default the taglet can be used everywhere.
      Specified by:
      getAllowedLocations in interface jdk.javadoc.doclet.Taglet
      Returns:
      the set of locations in which this taglet may be used.
    • isInlineTag

      public boolean isInlineTag()
      Returns true by default since this base class is about inline tags.
      Specified by:
      isInlineTag in interface jdk.javadoc.doclet.Taglet
      Returns:
      true if this tagle is an inline taglet.
    • text

      static String text(com.sun.source.doctree.DocTree tag)
      Returns the text contained in the given inline tag.
    • getCurrentFile

      protected final Path getCurrentFile()
      Returns the file that contains the current tag, or null if the method cannot determine the file.
      Returns:
      file containing the current tag, or null.
    • toString

      public final String toString(List<? extends com.sun.source.doctree.DocTree> tags, Element element)
      Given a list of DocTrees representing this custom tag, returns its string representation. This method will be invoked once for each instance of the tag in parsed Javadoc.
      Specified by:
      toString in interface jdk.javadoc.doclet.Taglet
      Parameters:
      tags - the tags to format.
      element - the element to which the enclosing comment belongs.
      Returns:
      a string representation of the given tags.
    • format

      protected abstract void format(com.sun.source.doctree.DocTree tag, StringBuilder appendTo)
      Given a single DocTrees representing this custom tag, returns its string representation. This method will be invoked once for each instance of the tag in parsed Javadoc.
      Parameters:
      tag - the tag to format.
      appendTo - the buffer where to format the tag.
    • printWarning

      protected final void printWarning(String message)
      Prints a warning message for the current tag.
      Parameters:
      message - the warning message to print.
    • printError

      protected final void printError(String message)
      Prints an error message for the current tag.
      Parameters:
      message - the error message to print.
    • print

      private void print(Diagnostic.Kind kind, String message)
      Prints an error or warning message.