APIdia Launch Partner
Top Description Inners Fields Constructors Methods
jdk.javadoc.internal.doclets.toolkit.util

public Class IndexItem

extends Object
Class Inheritance
Imports
java.util.Objects, javax.lang.model.element.Element, .ExecutableElement, .ModuleElement, .PackageElement, .TypeElement, .VariableElement, javax.lang.model.util.SimpleElementVisitor14, com.sun.source.doctree.DocTree

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:

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.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum
IndexItem.Category

The "category" used to group items for the interactive search index.

private static class
public static enum
IndexItem.Kind

The kind of index item.

Field Summary

Modifier and TypeField and Description
private String
containingClass

The containing class, if any, for the item.

private String
containingModule

The containing module, if any, for the item.

private String
containingPackage

The containing package, if any, for the item.

private final Element
element

The element for the item.

private final IndexItem.Kind
kind

The kind of the item.

private final String
label

The presentation string for the item.

private String
url

The URL pointing to the element, doc tree or page being indexed.

Constructor Summary

AccessConstructor and Description
private
IndexItem(Element element, String label, IndexItem.Kind kind)

private
IndexItem(Element element, String label, IndexItem.Kind kind, String url)

Method Summary

Modifier and TypeMethod and Description
private static String
public IndexItem.Category

Returns:

the category
getCategory
()

Returns the category for this item, that indicates the JavaScript file in which this item should be written.

protected IndexItem.Category
protected IndexItem.Category
public TypeElement

Returns:

the type 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.

public String

Returns:

the description of the tag
getDescription
()

Returns a description of the tag for this item or an empty string if no description is available for this item.

public DocTree

Returns:

the documentation tree node
getDocTree
()

Returns the documentation tree node for this item, of null if this item does not represent a documentation tree node.

public Element

Returns:

the element
getElement
()

Returns the element associate with this item, or null.

public String

Returns:

the fully qualified name
getFullyQualifiedLabel
(Utils
the common utilities class
utils
)

Returns the label with a fully-qualified type name.

public String

Returns:

the description of the element that owns this item
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.

public IndexItem.Kind

Returns:

the item kind
getKind
()

Returns the kind of this item.

public String

Returns:

the label
getLabel
()

Returns the label of the item.

public String

Returns:

the simple name
getSimpleName
()

Returns the part of the label after the last dot, or the whole label if there are no dots.

public String

Returns:

the URL for this item, or an empty string if no value has been set
getUrl
()

Returns the URL for this item, or an empty string if no value has been set.

public boolean

Returns:

true if this index is for an element
isElementItem
()

Returns true if this index is for an element.

public boolean

Returns:

true if this index is for a specific kind of tag in a doc comment
isKind
(DocTree.Kind kind)

Returns true if this index is for a specific kind of tag in a doc comment.

public boolean

Returns:

true if this index is for a tag in a doc comment
isTagItem
()

Returns true if this index is for a tag in a doc comment.

public static IndexItem

Returns:

the item
of
(ModuleElement
the element
moduleElement
,
Utils
the common utilities class
utils
)

Creates an index item for a module element.

public static IndexItem

Returns:

the item
of
(PackageElement
the element
packageElement
,
Utils
the common utilities class
utils
)

Creates an index item for a package element.

public static IndexItem

Returns:

the item
of
(TypeElement
the element
typeElement
,
Utils
the common utilities class
utils
)

Creates an index item for a type element.

public static IndexItem

Returns:

the item
of
(TypeElement
the element that contains the member
typeElement
,
Element
the member
member
,
Utils
the common utilities class
utils
)

Creates an index item for a member element.

public static IndexItem

Returns:

the item
of
(IndexItem.Category
the category for the item
category
,
String
the label for the item
label
,
DocPath
the path for the page
path
)

Creates an index item for a summary page, that is not associated with any element or node in a doc comment.

public IndexItem

Returns:

this item
setContainingClass
(String
the class
c
)

Sets the name of the containing class for this item.

public IndexItem

Returns:

this item
setContainingModule
(String
the module
m
)

Sets the name of the containing module for this item.

public IndexItem

Returns:

this item
setContainingPackage
(String
the package
p
)

Sets the name of the containing package for this item.

public IndexItem

Returns:

this item
setUrl
(String
the url
u
)

Sets the URL for the item, when it cannot otherwise be inferred from other fields.

public String

Returns:

a string representing this item in JSON notation
toJSON
()

Returns a string representing this item in JSON notation.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

containingClassback to summary
private String containingClass

The containing class, if any, for the item.

containingModuleback to summary
private String containingModule

The containing module, if any, for the item. It will be empty if the element is not in a package, and may be omitted if the name of the package is unique.

containingPackageback to summary
private String containingPackage

The containing package, if any, for the item.

elementback to summary
private final Element element

The element for the item. It is only null for items for summary pages that are not associated with any specific element.

kindback to summary
private final IndexItem.Kind kind

The kind of the item.

labelback to summary
private final String label

The presentation string for the item. It must be non-empty.

urlback to summary
private String url

The URL pointing to the element, doc tree or page being indexed. It may be empty if the information can be determined from other fields.

Constructor Detail

IndexItemback to summary
private IndexItem(Element element, String label, IndexItem.Kind kind)
IndexItemback to summary
private IndexItem(Element element, String label, IndexItem.Kind kind, String url)

Method Detail

escapeQuotesback to summary
private static String escapeQuotes(String s)
getCategoryback to summary
public IndexItem.Category getCategory()

Returns the category for this item, that indicates the JavaScript file in which this item should be written.

Returns:IndexItem.Category

the category

getCategoryback to summary
protected IndexItem.Category getCategory(DocTree docTree)
getCategoryback to summary
protected IndexItem.Category getCategory(Element element)
getContainingTypeElementback to summary
public TypeElement getContainingTypeElement()

Returns the type element that is documented as containing a member element, or null if this item does not represent a member element.

Returns:TypeElement

the type element

getDescriptionback to summary
public String getDescription()

Returns a description of the tag for this item or an empty string if no description is available for this item.

Returns:String

the description of the tag

getDocTreeback to summary
public DocTree getDocTree()

Returns the documentation tree node for this item, of null if this item does not represent a documentation tree node.

Returns:DocTree

the documentation tree node

getElementback to summary
public Element getElement()

Returns the element associate with this item, or null.

Returns:Element

the element

getFullyQualifiedLabelback to summary
public String getFullyQualifiedLabel(Utils utils)

Returns the label with a fully-qualified type name. (Used to determine if labels are unique or need to be qualified.)

Parameters
utils:Utils

the common utilities class

Returns:String

the fully qualified name

getHolderback to summary
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.

Returns:String

the description of the element that owns this item

getKindback to summary
public IndexItem.Kind getKind()

Returns the kind of this item.

Returns:IndexItem.Kind

the item kind

getLabelback to summary
public String getLabel()

Returns the label of the item.

Returns:String

the label

getSimpleNameback to summary
public String getSimpleName()

Returns the part of the label after the last dot, or the whole label if there are no dots.

Returns:String

the simple name

getUrlback to summary
public String getUrl()

Returns the URL for this item, or an empty string if no value has been set.

Returns:String

the URL for this item, or an empty string if no value has been set

isElementItemback to summary
public boolean isElementItem()

Returns true if this index is for an element.

Returns:boolean

true if this index is for an element

isKindback to summary
public boolean isKind(DocTree.Kind kind)

Returns true if this index is for a specific kind of tag in a doc comment.

Returns:boolean

true if this index is for a specific kind of tag in a doc comment

isTagItemback to summary
public boolean isTagItem()

Returns true if this index is for a tag in a doc comment.

Returns:boolean

true if this index is for a tag in a doc comment

ofback to summary
public static IndexItem of(ModuleElement moduleElement, Utils utils)

Creates an index item for a module element.

Parameters
moduleElement:ModuleElement

the element

utils:Utils

the common utilities class

Returns:IndexItem

the item

ofback to summary
public static IndexItem of(PackageElement packageElement, Utils utils)

Creates an index item for a package element.

Parameters
packageElement:PackageElement

the element

utils:Utils

the common utilities class

Returns:IndexItem

the item

ofback to summary
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.

Parameters
typeElement:TypeElement

the element

utils:Utils

the common utilities class

Returns:IndexItem

the item

ofback to summary
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.

Parameters
typeElement:TypeElement

the element that contains the member

member:Element

the member

utils:Utils

the common utilities class

Returns:IndexItem

the item

See Also
getContainingTypeElement()
ofback to summary
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.

Parameters
category:IndexItem.Category

the category for the item

label:String

the label for the item

path:DocPath

the path for the page

Returns:IndexItem

the item

setContainingClassback to summary
public IndexItem setContainingClass(String c)

Sets the name of the containing class for this item.

Parameters
c:String

the class

Returns:IndexItem

this item

setContainingModuleback to summary
public IndexItem setContainingModule(String m)

Sets the name of the containing module for this item.

Parameters
m:String

the module

Returns:IndexItem

this item

setContainingPackageback to summary
public IndexItem setContainingPackage(String p)

Sets the name of the containing package for this item.

Parameters
p:String

the package

Returns:IndexItem

this item

setUrlback to summary
public IndexItem setUrl(String u)

Sets the URL for the item, when it cannot otherwise be inferred from other fields.

Parameters
u:String

the url

Returns:IndexItem

this item

toJSONback to summary
public String toJSON()

Returns a string representing this item in JSON notation.

Returns:String

a string representing this item in JSON notation

jdk.javadoc.internal.doclets.toolkit.util back to summary

public final Enum IndexItem.Category

extends Enum<IndexItem.Category>
Class Inheritance

The "category" used to group items for the interactive search index. Categories correspond directly to the JavaScript files that will be generated.

Field Summary

Modifier and TypeField and Description
public static final IndexItem.Category
public static final IndexItem.Category
public static final IndexItem.Category
public static final IndexItem.Category
public static final IndexItem.Category

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static IndexItem.Category
public static IndexItem.Category[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

MEMBERSback to summary
public static final IndexItem.Category MEMBERS
MODULESback to summary
public static final IndexItem.Category MODULES
PACKAGESback to summary
public static final IndexItem.Category PACKAGES
TAGSback to summary
public static final IndexItem.Category TAGS
TYPESback to summary
public static final IndexItem.Category TYPES

Constructor Detail

Categoryback to summary
private Category()

Method Detail

valueOfback to summary
public static IndexItem.Category valueOf(String name)
valuesback to summary
public static IndexItem.Category[] values()
jdk.javadoc.internal.doclets.toolkit.util back to summary

private Class IndexItem.JSONBuilder

extends Object
Class Inheritance
  • java.lang.Object
  • jdk.javadoc.internal.doclets.toolkit.util.IndexItem.JSONBuilder

Field Summary

Modifier and TypeField and Description
pack-priv StringBuilder
b

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public IndexItem.JSONBuilder
append(String name, Object value)

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

bback to summary
pack-priv StringBuilder b

Constructor Detail

JSONBuilderback to summary
private JSONBuilder()

Method Detail

appendback to summary
public IndexItem.JSONBuilder append(String name, Object value)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override
jdk.javadoc.internal.doclets.toolkit.util back to summary

public final Enum IndexItem.Kind

extends Enum<IndexItem.Kind>
Class Inheritance

The kind of index item. Index items can represent program elements, various doc comment tags, or other resources such as summary pages. Values in this enum must match elements in array itemDesc in JavaScript file search.js.template!

Field Summary

Modifier and TypeField and Description
public static final IndexItem.Kind
public static final IndexItem.Kind
public static final IndexItem.Kind
public static final IndexItem.Kind
public static final IndexItem.Kind
public static final IndexItem.Kind
public static final IndexItem.Kind
public static final IndexItem.Kind
public static final IndexItem.Kind
public static final IndexItem.Kind
public static final IndexItem.Kind
public static final IndexItem.Kind
public static final IndexItem.Kind
public static final IndexItem.Kind
public static final IndexItem.Kind
public static final IndexItem.Kind
public static final IndexItem.Kind
public static final IndexItem.Kind
public static final IndexItem.Kind

Constructor Summary

AccessConstructor and Description
private
Kind()

Method Summary

Modifier and TypeMethod and Description
public static IndexItem.Kind

Returns:

the kind of index item for a doc comment tag
ofDocTree
(DocTree tree)

Returns the kind of index item for a doc comment tag.

public static IndexItem.Kind

Returns:

the kind of index item for a program element
ofElement
(Element elem, Utils utils)

Returns the kind of index item for a program element.

public static IndexItem.Kind
public static IndexItem.Kind[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

ANNOTATION_ELEMENTback to summary
public static final IndexItem.Kind ANNOTATION_ELEMENT
ANNOTATION_TYPEback to summary
public static final IndexItem.Kind ANNOTATION_TYPE
CLASSback to summary
public static final IndexItem.Kind CLASS
CONSTRUCTORback to summary
public static final IndexItem.Kind CONSTRUCTOR
ENUMback to summary
public static final IndexItem.Kind ENUM
ENUM_CONSTANTback to summary
public static final IndexItem.Kind ENUM_CONSTANT
EXCEPTION_CLASSback to summary
public static final IndexItem.Kind EXCEPTION_CLASS
EXTERNAL_SPECback to summary
public static final IndexItem.Kind EXTERNAL_SPEC
FIELDback to summary
public static final IndexItem.Kind FIELD
INTERFACEback to summary
public static final IndexItem.Kind INTERFACE
METHODback to summary
public static final IndexItem.Kind METHOD
RECORDback to summary
public static final IndexItem.Kind RECORD
RECORD_COMPONENTback to summary
public static final IndexItem.Kind RECORD_COMPONENT
SEARCH_ITEMback to summary
public static final IndexItem.Kind SEARCH_ITEM
SECTIONback to summary
public static final IndexItem.Kind SECTION
STATIC_FIELDback to summary
public static final IndexItem.Kind STATIC_FIELD
STATIC_METHODback to summary
public static final IndexItem.Kind STATIC_METHOD
SUMMARY_PAGEback to summary
public static final IndexItem.Kind SUMMARY_PAGE
SYSTEM_PROPERTYback to summary
public static final IndexItem.Kind SYSTEM_PROPERTY

Constructor Detail

Kindback to summary
private Kind()

Method Detail

ofDocTreeback to summary
public static IndexItem.Kind ofDocTree(DocTree tree)

Returns the kind of index item for a doc comment tag.

Returns:IndexItem.Kind

the kind of index item for a doc comment tag

ofElementback to summary
public static IndexItem.Kind ofElement(Element elem, Utils utils)

Returns the kind of index item for a program element.

Returns:IndexItem.Kind

the kind of index item for a program element

valueOfback to summary
public static IndexItem.Kind valueOf(String name)
valuesback to summary
public static IndexItem.Kind[] values()