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

public Class ClassTree

extends Object
Class Inheritance
Imports
java.util.ArrayList, .Collections, .Comparator, .EnumMap, .HashMap, .List, .Map, .Set, .SortedSet, .TreeSet, javax.lang.model.element.Element, .TypeElement, javax.lang.model.type.TypeMirror, jdk.javadoc.internal.doclets.toolkit.BaseConfiguration, .Messages

Class and interface hierarchies.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
ClassTree.Hierarchy

A "hierarchy" provides the subtypes of all the supertypes of a set of leaf elements, together with the root supertype(s).

private static enum
ClassTree.HierarchyKind

The kind of hierarchy.

private static class
ClassTree.SubtypeMap

A map giving the subtypes for each of a collection of type elements.

Field Summary

Modifier and TypeField and Description
private final BaseConfiguration
private final Map<ClassTree.HierarchyKind, ClassTree.Hierarchy>
hierarchies

The collection of hierarchies, indexed by kind.

private final ClassTree.SubtypeMap
implementingClasses

Mapping for each interface with classes that implement it.

private final Utils

Constructor Summary

AccessConstructor and Description
public
ClassTree(BaseConfiguration
the configuration of the doclet
configuration
)

Constructor.

public
ClassTree(SortedSet<TypeElement>
a set of classes
classesSet
,
BaseConfiguration
The current configuration of the doclet.
configuration
)

Constructor.

Method Summary

Modifier and TypeMethod and Description
public ClassTree.Hierarchy

Returns:

the hierarchy for which the leaf nodes are annotation interfaces
annotationInterfaces
()

Returns the hierarchy for which the leaf nodes are annotation interfaces.

private void
buildTree(Iterable<TypeElement>
the type elements
typeElements
)

Generate the hierarchies for the given type elements.

public ClassTree.Hierarchy

Returns:

the hierarchy for which the leaf nodes are plain classes
classes
()

Returns the hierarchy for which the leaf nodes are plain classes.

public ClassTree.Hierarchy

Returns:

the hierarchy for which the leaf nodes are enum classes
enumClasses
()

Returns the hierarchy for which the leaf nodes are enum classes.

public ClassTree.Hierarchy
hierarchy(TypeElement typeElement)

public SortedSet<TypeElement>
implementingClasses(TypeElement
interface whose implementing-classes set is required.
typeElement
)

Return the set of classes which implement the interface passed.

public ClassTree.Hierarchy

Returns:

the hierarchy for which the leaf nodes are plain interfaces
interfaces
()

Returns the hierarchy for which the leaf nodes are plain interfaces.

private void
processInterface(TypeElement
Interface under consideration.
typeElement
)

For the interface passed get the interfaces which it extends, and then put this interface in the subinterface set of those interfaces.

private void
processType(TypeElement
for which the hierarchy is to be generated
typeElement
,
ClassTree.Hierarchy
the hierarchy
hierarchy
)

Adds details for a type element into a given hierarchy.

public ClassTree.Hierarchy

Returns:

the hierarchy for which the leaf nodes are record classes
recordClasses
()

Returns the hierarchy for which the leaf nodes are record classes.

public SortedSet<TypeElement>
subClasses(TypeElement
class whose subclass set is required.
typeElement
)

Return the subclass set for the class passed.

public SortedSet<TypeElement>
subInterfaces(TypeElement
interface whose subinterface set is required.
typeElement
)

Return the subinterface set for the interface passed.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

configurationback to summary
private final BaseConfiguration configuration
hierarchiesback to summary
private final Map<ClassTree.HierarchyKind, ClassTree.Hierarchy> hierarchies

The collection of hierarchies, indexed by kind.

implementingClassesback to summary
private final ClassTree.SubtypeMap implementingClasses

Mapping for each interface with classes that implement it.

utilsback to summary
private final Utils utils

Constructor Detail

ClassTreeback to summary
public ClassTree(BaseConfiguration configuration)

Constructor. Build the tree for all the included type elements.

Parameters
configuration:BaseConfiguration

the configuration of the doclet

ClassTreeback to summary
public ClassTree(SortedSet<TypeElement> classesSet, BaseConfiguration configuration)

Constructor. Build the tree for the given collection of classes.

Parameters
classesSet:SortedSet<TypeElement>

a set of classes

configuration:BaseConfiguration

The current configuration of the doclet.

Method Detail

annotationInterfacesback to summary
public ClassTree.Hierarchy annotationInterfaces()

Returns the hierarchy for which the leaf nodes are annotation interfaces.

Returns:ClassTree.Hierarchy

the hierarchy for which the leaf nodes are annotation interfaces

buildTreeback to summary
private void buildTree(Iterable<TypeElement> typeElements)

Generate the hierarchies for the given type elements.

Parameters
typeElements:Iterable<TypeElement>

the type elements

classesback to summary
public ClassTree.Hierarchy classes()

Returns the hierarchy for which the leaf nodes are plain classes.

Returns:ClassTree.Hierarchy

the hierarchy for which the leaf nodes are plain classes

enumClassesback to summary
public ClassTree.Hierarchy enumClasses()

Returns the hierarchy for which the leaf nodes are enum classes.

Returns:ClassTree.Hierarchy

the hierarchy for which the leaf nodes are enum classes

hierarchyback to summary
public ClassTree.Hierarchy hierarchy(TypeElement typeElement)
implementingClassesback to summary
public SortedSet<TypeElement> implementingClasses(TypeElement typeElement)

Return the set of classes which implement the interface passed.

Parameters
typeElement:TypeElement

interface whose implementing-classes set is required.

interfacesback to summary
public ClassTree.Hierarchy interfaces()

Returns the hierarchy for which the leaf nodes are plain interfaces.

Returns:ClassTree.Hierarchy

the hierarchy for which the leaf nodes are plain interfaces

processInterfaceback to summary
private void processInterface(TypeElement typeElement)

For the interface passed get the interfaces which it extends, and then put this interface in the subinterface set of those interfaces. Do it recursively. If an interface doesn't have superinterface just attach that interface in the set of all the baseInterfaces.

Parameters
typeElement:TypeElement

Interface under consideration.

processTypeback to summary
private void processType(TypeElement typeElement, ClassTree.Hierarchy hierarchy)

Adds details for a type element into a given hierarchy. The subtypes are updated for the transitive closure of all supertypes of this type element. If this type element has no superclass or superinterfaces, it is marked as a root.

Parameters
typeElement:TypeElement

for which the hierarchy is to be generated

hierarchy:ClassTree.Hierarchy

the hierarchy

recordClassesback to summary
public ClassTree.Hierarchy recordClasses()

Returns the hierarchy for which the leaf nodes are record classes.

Returns:ClassTree.Hierarchy

the hierarchy for which the leaf nodes are record classes

subClassesback to summary
public SortedSet<TypeElement> subClasses(TypeElement typeElement)

Return the subclass set for the class passed.

Parameters
typeElement:TypeElement

class whose subclass set is required.

subInterfacesback to summary
public SortedSet<TypeElement> subInterfaces(TypeElement typeElement)

Return the subinterface set for the interface passed.

Parameters
typeElement:TypeElement

interface whose subinterface set is required.

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

public Class ClassTree.Hierarchy

extends Object
Class Inheritance
  • java.lang.Object
  • jdk.javadoc.internal.doclets.toolkit.util.ClassTree.Hierarchy

A "hierarchy" provides the subtypes of all the supertypes of a set of leaf elements, together with the root supertype(s).

Field Summary

Modifier and TypeField and Description
private final Comparator<Element>
private final SortedSet<TypeElement>
private final ClassTree.SubtypeMap

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public SortedSet<TypeElement>

Returns:

the set of all subtypes of the given type element, or an empty set if there are none
allSubtypes
(TypeElement
the type element
typeElement
)

Returns the set of all subtypes of the given type element, or an empty set if there are none.

public SortedSet<TypeElement>

Returns:

the roots of the hierarchy
roots
()

Returns the roots of the hierarchy.

public SortedSet<TypeElement>

Returns:

the immediate subtypes of the given type element, or an empty set if there are none
subtypes
(TypeElement
the type element
typeElement
)

Returns the immediate subtypes of the given type element, or an empty set if there are none.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

comparatorback to summary
private final Comparator<Element> comparator
rootsback to summary
private final SortedSet<TypeElement> roots
subtypesback to summary
private final ClassTree.SubtypeMap subtypes

Constructor Detail

Hierarchyback to summary
pack-priv Hierarchy(Comparator<Element> comparator)

Method Detail

allSubtypesback to summary
public SortedSet<TypeElement> allSubtypes(TypeElement typeElement)

Returns the set of all subtypes of the given type element, or an empty set if there are none. The set of all subtypes is the transitive closure of the immediate subtypes of the given type element.

Parameters
typeElement:TypeElement

the type element

Returns:SortedSet<TypeElement>

the set of all subtypes of the given type element, or an empty set if there are none

rootsback to summary
public SortedSet<TypeElement> roots()

Returns the roots of the hierarchy. Each root is a class or interface with no superclass or superinterfaces. If the hierarchy just contains classes, the root will be java.lang.Object.

Returns:SortedSet<TypeElement>

the roots of the hierarchy

subtypesback to summary
public SortedSet<TypeElement> subtypes(TypeElement typeElement)

Returns the immediate subtypes of the given type element, or an empty set if there are none.

Parameters
typeElement:TypeElement

the type element

Returns:SortedSet<TypeElement>

the immediate subtypes of the given type element, or an empty set if there are none

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

private final Enum ClassTree.HierarchyKind

extends Enum<ClassTree.HierarchyKind>
Class Inheritance

The kind of hierarchy. Currently, the kinds correspond to the kinds of declared types, although other partitions could be possible.

Field Summary

Modifier and TypeField and Description
public static final ClassTree.HierarchyKind
public static final ClassTree.HierarchyKind
public static final ClassTree.HierarchyKind
public static final ClassTree.HierarchyKind
public static final ClassTree.HierarchyKind

Constructor Summary

AccessConstructor and Description
private

Method Summary

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

Field Detail

ANNOTATION_INTERFACESback to summary
public static final ClassTree.HierarchyKind ANNOTATION_INTERFACES
CLASSESback to summary
public static final ClassTree.HierarchyKind CLASSES
ENUM_CLASSESback to summary
public static final ClassTree.HierarchyKind ENUM_CLASSES
INTERFACESback to summary
public static final ClassTree.HierarchyKind INTERFACES
RECORD_CLASSESback to summary
public static final ClassTree.HierarchyKind RECORD_CLASSES

Constructor Detail

HierarchyKindback to summary
private HierarchyKind()

Method Detail

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

private Class ClassTree.SubtypeMap

extends HashMap<TypeElement, SortedSet<TypeElement>>
Class Inheritance
Annotations
@SuppressWarnings:serial

A map giving the subtypes for each of a collection of type elements. The subtypes may be subclasses or subinterfaces, depending on the context. The subtypes are recorded by calling addSubtype.

Field Summary

Modifier and TypeField and Description
private final Comparator<Element>

Constructor Summary

AccessConstructor and Description
pack-priv
SubtypeMap(Comparator<Element>
the comparator
comparator
)

Creates a map to provide the subtypes of a type element, sorted according to a given comparator.

Method Summary

Modifier and TypeMethod and Description
pack-priv boolean

Returns:

true if this set did not already contain the specified element
addSubtype
(TypeElement
the type element
typeElement
,
TypeElement
the subtype
subtype
)

Adds a subtype into the set of subtypes for a type element

pack-priv SortedSet<TypeElement>

Returns:

the subtypes for a type element, or an empty set if there are none
getSubtypes
(TypeElement
the type element
typeElement
)

Returns the subtypes for a type element, or an empty set if there are none.

Inherited from java.util.HashMap:
clearclonecomputecomputeIfAbsentcomputeIfPresentcontainsKeycontainsValueentrySetforEachgetgetOrDefaultisEmptykeySetmergenewHashMapputputAllputIfAbsentremoveremovereplacereplacereplaceAllsizevalues

Field Detail

comparatorback to summary
private final Comparator<Element> comparator

Constructor Detail

SubtypeMapback to summary
pack-priv SubtypeMap(Comparator<Element> comparator)

Creates a map to provide the subtypes of a type element, sorted according to a given comparator. An alternate implementation would be to store the subtypes unsorted, and to lazily sort them when needed, such as when generating documentation.

Parameters
comparator:Comparator<Element>

the comparator

Method Detail

addSubtypeback to summary
pack-priv boolean addSubtype(TypeElement typeElement, TypeElement subtype)

Adds a subtype into the set of subtypes for a type element

Parameters
typeElement:TypeElement

the type element

subtype:TypeElement

the subtype

Returns:boolean

true if this set did not already contain the specified element

getSubtypesback to summary
pack-priv SortedSet<TypeElement> getSubtypes(TypeElement typeElement)

Returns the subtypes for a type element, or an empty set if there are none.

Parameters
typeElement:TypeElement

the type element

Returns:SortedSet<TypeElement>

the subtypes for a type element, or an empty set if there are none