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

public abstract Class IndexBuilder

extends Object
Class Inheritance
Known Direct Subclasses
jdk.javadoc.internal.doclets.formats.html.HtmlIndexBuilder
Imports
java.util.*, java.util.stream.Collectors, javax.lang.model.element.Element, .ModuleElement, .PackageElement, .TypeElement, com.sun.source.doctree.DocTree, jdk.javadoc.internal.doclets.toolkit.BaseConfiguration

An alphabetical index of elements, search tags, and other items. Two tables are maintained: one is indexed by the first character of each item's name; the other is indexed by the item's category, indicating the JavaScript file in which the item should be written.

Field Summary

Modifier and TypeField and Description
protected final BaseConfiguration
private final Map<IndexItem.Category, SortedSet<IndexItem>>
itemsByCategory

Sets of items keyed by the category of the items in those sets.

private final Map<Character, SortedSet<IndexItem>>
itemsByFirstChar

Sets of items keyed by the first character of the names (labels) of the items in those sets.

private final Comparator<IndexItem>
mainComparator

The comparator used for the sets in itemsByFirstChar.

private final boolean
noDeprecated

Don't generate deprecated information if true.

protected final Utils

Constructor Summary

AccessConstructor and Description
public
IndexBuilder(BaseConfiguration
the current configuration of the doclet
configuration
)

Creates a new IndexBuilder.

Method Summary

Modifier and TypeMethod and Description
public void
add(IndexItem
the item to add
item
)

Adds an individual item to the two collections of items.

public void
addElements()

Adds all the selected modules, packages, types and their members to the index.

public List<Character>
getFirstCharacters()

Returns a sorted list of the first characters of the labels of index items.

private String
public SortedSet<IndexItem>

Returns:

list of items keyed by the provided character
getItems
(Character
index key
key
)

Returns a sorted list of items whose names start with the provided character.

public SortedSet<IndexItem>

Returns:

list of items keyed by the provided character
getItems
(IndexItem.Category
the category
cat
)

Returns a sorted list of items in a given category.

public SortedSet<IndexItem>

Returns:

list of items keyed by the provided character
getItems
(DocTree.Kind
the kind
kind
)

Returns a sorted list of items with a given kind of doc tree.

private void
indexMembers(TypeElement
TypeElement whose members are to be indexed
te
)

Indexes all the members (fields, methods, constructors, etc.) of the provided type element.

private void
indexMembers(TypeElement typeElement, Iterable<? extends Element>
a collection of elements
members
)

Indexes the provided elements.

private void
indexModules()

Indexes all the modules.

private void
indexPackage(PackageElement
the package element
packageElement
)

Index the given package element.

private void
indexTypeElements(Iterable<TypeElement>
type elements
elements
)

Index the given type elements.

private static Character
private Comparator<IndexItem>

Returns:

a comparator for index page items
makeComparator
()

Returns a comparator for the IndexItems in the index page.

public Comparator<IndexItem>

Returns:

a Comparator
makeGenericSearchIndexComparator
()

Returns a Comparator for IndexItems in the modules, packages, members, and search tags categories of the search index.

public Comparator<IndexItem>

Returns:

a Comparator
makeTypeSearchIndexComparator
()

Returns a Comparator for IndexItems in the types category of the search index.

private boolean
shouldIndex(Element element)

Should this element be added to the index?

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

configurationback to summary
protected final BaseConfiguration configuration
itemsByCategoryback to summary
private final Map<IndexItem.Category, SortedSet<IndexItem>> itemsByCategory

Sets of items keyed by the category of the items in those sets.

itemsByFirstCharback to summary
private final Map<Character, SortedSet<IndexItem>> itemsByFirstChar

Sets of items keyed by the first character of the names (labels) of the items in those sets.

mainComparatorback to summary
private final Comparator<IndexItem> mainComparator

The comparator used for the sets in itemsByFirstChar.

noDeprecatedback to summary
private final boolean noDeprecated

Don't generate deprecated information if true.

utilsback to summary
protected final Utils utils

Constructor Detail

IndexBuilderback to summary
public IndexBuilder(BaseConfiguration configuration)

Creates a new IndexBuilder.

Parameters
configuration:BaseConfiguration

the current configuration of the doclet

Method Detail

addback to summary
public void add(IndexItem item)

Adds an individual item to the two collections of items.

Parameters
item:IndexItem

the item to add

addElementsback to summary
public void addElements()

Adds all the selected modules, packages, types and their members to the index.

getFirstCharactersback to summary
public List<Character> getFirstCharacters()

Returns a sorted list of the first characters of the labels of index items.

getIndexItemKeyback to summary
private String getIndexItemKey(IndexItem ii)
getItemsback to summary
public SortedSet<IndexItem> getItems(Character key)

Returns a sorted list of items whose names start with the provided character.

Parameters
key:Character

index key

Returns:SortedSet<IndexItem>

list of items keyed by the provided character

getItemsback to summary
public SortedSet<IndexItem> getItems(IndexItem.Category cat)

Returns a sorted list of items in a given category.

Parameters
cat:IndexItem.Category

the category

Returns:SortedSet<IndexItem>

list of items keyed by the provided character

getItemsback to summary
public SortedSet<IndexItem> getItems(DocTree.Kind kind)

Returns a sorted list of items with a given kind of doc tree.

Parameters
kind:DocTree.Kind

the kind

Returns:SortedSet<IndexItem>

list of items keyed by the provided character

indexMembersback to summary
private void indexMembers(TypeElement te)

Indexes all the members (fields, methods, constructors, etc.) of the provided type element.

Parameters
te:TypeElement

TypeElement whose members are to be indexed

indexMembersback to summary
private void indexMembers(TypeElement typeElement, Iterable<? extends Element> members)

Indexes the provided elements.

Parameters
members:Iterable<? extends Element>

a collection of elements

indexModulesback to summary
private void indexModules()

Indexes all the modules.

indexPackageback to summary
private void indexPackage(PackageElement packageElement)

Index the given package element.

Parameters
packageElement:PackageElement

the package element

indexTypeElementsback to summary
private void indexTypeElements(Iterable<TypeElement> elements)

Index the given type elements.

Parameters
elements:Iterable<TypeElement>

type elements

keyCharacterback to summary
private static Character keyCharacter(String s)
makeComparatorback to summary
private Comparator<IndexItem> makeComparator()

Returns a comparator for the IndexItems in the index page. This is a composite comparator that must be able to compare all kinds of items: for element items, tag items, and others.

Returns:Comparator<IndexItem>

a comparator for index page items

makeGenericSearchIndexComparatorback to summary
public Comparator<IndexItem> makeGenericSearchIndexComparator()

Returns a Comparator for IndexItems in the modules, packages, members, and search tags categories of the search index. Items are compared by label, falling back to the main comparator if names are equal.

Returns:Comparator<IndexItem>

a Comparator

makeTypeSearchIndexComparatorback to summary
public Comparator<IndexItem> makeTypeSearchIndexComparator()

Returns a Comparator for IndexItems in the types category of the search index. Items are compared by short name, falling back to the main comparator if names are equal.

Returns:Comparator<IndexItem>

a Comparator

shouldIndexback to summary
private boolean shouldIndex(Element element)

Should this element be added to the index?