Class IndexingSink

All Implemented Interfaces:
AutoCloseable, Markup, org.apache.maven.doxia.sink.Sink
Direct Known Subclasses:
CreateAnchorsForIndexEntries

public class IndexingSink extends SinkWrapper
A sink wrapper for populating an index tree for particular elements in a document. Currently this only generates IndexEntry objects for sections.
Author:
Trygve Laugstøl, Vincent Siveton
  • Constructor Details

  • Method Details

    • getRootEntry

      public IndexEntry getRootEntry()
      This should only be called once the sink is closed. Before that the tree might not be complete.
      Returns:
      the tree of entries starting from the root
      Throws:
      IllegalStateException - in case the sink was not closed yet
    • getTitle

      public String getTitle()

      Getter for the field title.

      Shortcut for getRootEntry() followed by IndexEntry.getTitle().
      Returns:
      the title
    • title

      public void title(org.apache.maven.doxia.sink.SinkEventAttributes attributes)
      Specified by:
      title in interface org.apache.maven.doxia.sink.Sink
      Overrides:
      title in class SinkWrapper
    • title_

      public void title_()
      Specified by:
      title_ in interface org.apache.maven.doxia.sink.Sink
      Overrides:
      title_ in class SinkWrapper
    • section

      public void section(int level, org.apache.maven.doxia.sink.SinkEventAttributes attributes)
      Specified by:
      section in interface org.apache.maven.doxia.sink.Sink
      Overrides:
      section in class SinkWrapper
    • section_

      public void section_(int level)
      Specified by:
      section_ in interface org.apache.maven.doxia.sink.Sink
      Overrides:
      section_ in class SinkWrapper
    • sectionTitle_

      public void sectionTitle_(int level)
      Specified by:
      sectionTitle_ in interface org.apache.maven.doxia.sink.Sink
      Overrides:
      sectionTitle_ in class SinkWrapper
    • text

      public void text(String text, org.apache.maven.doxia.sink.SinkEventAttributes attributes)
      Specified by:
      text in interface org.apache.maven.doxia.sink.Sink
      Overrides:
      text in class SinkWrapper
    • anchor

      public void anchor(String name, org.apache.maven.doxia.sink.SinkEventAttributes attributes)
      Specified by:
      anchor in interface org.apache.maven.doxia.sink.Sink
      Overrides:
      anchor in class SinkWrapper
    • onIndexEntry

      protected void onIndexEntry(IndexEntry entry)
      Called at the beginning of each entry (once all metadata about it is collected). The events for the metadata are buffered and only flushed after this method was called.
      Parameters:
      entry - the newly collected entry
    • push

      public void push(IndexEntry entry)
      Pushes an IndexEntry onto the top of this stack.
      Parameters:
      entry - to put.
    • pop

      public void pop()
      Removes the IndexEntry at the top of this stack.
    • peek

      public IndexEntry peek()

      peek.

      Returns:
      Looks at the IndexEntry at the top of this stack.
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface org.apache.maven.doxia.sink.Sink
      Overrides:
      close in class SinkWrapper