java.lang.Object
org.jdrupes.mdoclet.internal.doclets.toolkit.util.IndexItem

public class IndexItem extends Object
An item to be included in the index pages and in interactive search.

Items are primarily defined by their position in the documentation, which is one of:

  • An element (module, package, type or member)
  • One of a small set of tags in the doc comment for an element: {@index ...}, {@systemProperty ...}, etc
  • One of a small set of outliers, corresponding to summary pages: "All Classes", "All Packages", etc

All items have a "label", which is the presentation string used to display the item in the list of matching choices. The label is specified when the item is created. Items also have a "url" and a "description", which are provided by the specific doclet.

Each item provides details to be included in the search index files read and processed by JavaScript. Items have a "category", which is normally derived from the element kind or doc tree kind; it corresponds to the JavaScript file in which this item will be written.

Items for an element may have one or more of the following: "containing module", "containing package", "containing type".

Items for a node in a doc tree have a "holder", which is a text form of the enclosing element or page. They will typically also have a "description" derived from content in the doc tree node.

  • Methodendetails

    • of

      public static IndexItem of(ModuleElement moduleElement, Utils utils)
      Creates an index item for a module element.
      Parameter:
      moduleElement - the element
      utils - the common utilities class
      Gibt zurück:
      the item
    • of

      public static IndexItem of(PackageElement packageElement, Utils utils)
      Creates an index item for a package element.
      Parameter:
      packageElement - the element
      utils - the common utilities class
      Gibt zurück:
      the item
    • of

      public static IndexItem of(TypeElement typeElement, Utils utils)
      Creates an index item for a type element.

      Note: use getElement() to access this value, not getTypeElement.

      Parameter:
      typeElement - the element
      utils - the common utilities class
      Gibt zurück:
      the item
    • of

      public static IndexItem of(TypeElement typeElement, Element member, Utils utils)
      Creates an index item for a member element.

      Note: the given type element may not be the same as the enclosing element of the member in cases where the enclosing element is not visible in the documentation.

      Parameter:
      typeElement - the element that contains the member
      member - the member
      utils - the common utilities class
      Gibt zurück:
      the item
      Siehe auch:
    • of

      public static IndexItem of(Element element, DocTree docTree, String label, String holder, String description, DocLink link)
      Creates an index item for a node in the doc comment for an element.

      The node should only be one that gives rise to an entry in the index.

      Parameter:
      element - the element
      docTree - the node in the doc comment
      label - the label
      holder - the holder for the comment
      description - the description of the item
      link - the root-relative link to the item in the generated docs
      Gibt zurück:
      the item
    • of

      public static IndexItem of(IndexItem.Category category, String label, DocPath path)
      Creates an index item for a summary page, that is not associated with any element or node in a doc comment.
      Parameter:
      category - the category for the item
      label - the label for the item
      path - the path for the page
      Gibt zurück:
      the item
    • getLabel

      public String getLabel()
      Returns the label of the item.
      Gibt zurück:
      the label
    • getSimpleName

      Returns the part of the label after the last dot, or the whole label if there are no dots.
      Gibt zurück:
      the simple name
    • getFullyQualifiedLabel

      Returns the label with a fully-qualified type name.

      (Used to determine if labels are unique or need to be qualified.)

      Parameter:
      utils - the common utilities class
      Gibt zurück:
      the fully qualified name
    • getElement

      public Element getElement()
      Returns the element associate with this item, or null.
      Gibt zurück:
      the element
    • getCategory

      Returns the category for this item, that indicates the JavaScript file in which this item should be written.
      Gibt zurück:
      the category
    • getCategory

      protected IndexItem.Category getCategory(DocTree docTree)
    • getCategory

      protected IndexItem.Category getCategory(Element element)
    • getContainingTypeElement

      Returns the type element that is documented as containing a member element, or null if this item does not represent a member element.
      Gibt zurück:
      the type element
    • getDocTree

      public DocTree getDocTree()
      Returns the documentation tree node for this item, of null if this item does not represent a documentation tree node.
      Gibt zurück:
      the documentation tree node
    • isElementItem

      public boolean isElementItem()
      Returns true if this index is for an element.
      Gibt zurück:
      true if this index is for an element
    • isTagItem

      public boolean isTagItem()
      Returns true if this index is for a tag in a doc comment.
      Gibt zurück:
      true if this index is for a tag in a doc comment
    • isKind

      public boolean isKind(DocTree.Kind kind)
      Returns true if this index is for a specific kind of tag in a doc comment.
      Gibt zurück:
      true if this index is for a specific kind of tag in a doc comment
    • setUrl

      public IndexItem setUrl(String u)
      Sets the URL for the item, when it cannot otherwise be inferred from other fields.
      Parameter:
      u - the url
      Gibt zurück:
      this item
    • getUrl

      public String getUrl()
      Returns the URL for this item, or an empty string if no value has been set.
      Gibt zurück:
      the URL for this item, or an empty string if no value has been set
    • setContainingModule

      Sets the name of the containing module for this item.
      Parameter:
      m - the module
      Gibt zurück:
      this item
    • setContainingPackage

      Sets the name of the containing package for this item.
      Parameter:
      p - the package
      Gibt zurück:
      this item
    • setContainingClass

      Sets the name of the containing class for this item.
      Parameter:
      c - the class
      Gibt zurück:
      this item
    • getHolder

      public String getHolder()
      Returns a description of the element owning the documentation comment for this item, or null if this is not a item for a tag for an item in a documentation tag.
      Gibt zurück:
      the description of the element that owns this item
    • getDescription

      Returns a description of the tag for this item or null if this is not a item for a tag for an item in a documentation tag.
      Gibt zurück:
      the description of the tag
    • toJSON

      public String toJSON()
      Returns a string representing this item in JSON notation.
      Gibt zurück:
      a string representing this item in JSON notation