Top Description Fields Constructors Methods
org.jboss.jandex

public Class CompositeIndex

extends Object
implements IndexView
Class Inheritance
All Implemented Interfaces
org.jboss.jandex.IndexView
Imports
java.lang.reflect.Modifier, java.util.ArrayDeque, .ArrayList, .Arrays, .Collection, .Collections, .HashSet, .Iterator, .List, .Queue, .Set

Composite annotation index. Represents an aggregation of multiple Index instances. An example application is a Java EE deployment, which can contain multiple nested jars, each with their own index.
Authors
John Bailey, Stuart Douglas, Jason T Greene

Field Summary

Modifier and TypeField and Description
pack-priv final Collection<IndexView>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static CompositeIndex
public static CompositeIndex
create(final IndexView... indexes)

public static CompositeIndex
createMerged(final CompositeIndex... indexes)

public Set<ClassInfo>
getAllKnownImplementors(final DotName
The interface
interfaceName
)

Implements org.jboss.jandex.IndexView.getAllKnownImplementors.

Returns all known classes that implement the given interface, directly and indirectly.
public Set<ClassInfo>
getAllKnownSubclasses(final DotName
The class
className
)

Implements org.jboss.jandex.IndexView.getAllKnownSubclasses.

Returns all known (including non-direct) subclasses of the given class.
private void
getAllKnownSubClasses(DotName className, Set<ClassInfo> allKnown, Set<DotName> processedClasses)

private void
getAllKnownSubClasses(DotName name, Set<ClassInfo> allKnown, Set<DotName> subClassesToProcess, Set<DotName> processedClasses)

public Collection<ClassInfo>
getAllKnownSubinterfaces(DotName
The interace
interfaceName
)

Implements org.jboss.jandex.IndexView.getAllKnownSubinterfaces.

Returns all known interfaces that extend the given interface, directly and indirectly.
public List<AnnotationInstance>
getAnnotations(final DotName
the name of the annotation to look for
annotationName
)

Implements org.jboss.jandex.IndexView.getAnnotations.

Obtains a list of instances for the specified annotation.
public Collection<AnnotationInstance>
getAnnotationsWithRepeatable(DotName
the name of the repeatable annotation
annotationName
,
IndexView
the index containing the annotation class
index
)

Implements org.jboss.jandex.IndexView.getAnnotationsWithRepeatable.

Obtains a list of instances for the specified annotation.
public ClassInfo
getClassByName(final DotName
the name of the class
className
)

Implements org.jboss.jandex.IndexView.getClassByName.

Gets the class (or interface, or annotation) that was scanned during the indexing phase.
public Collection<ClassInfo>
getClassesInPackage(DotName
package name in the common, dot-separated form (e.g. com.example.foobar); null means the unnamed package
packageName
)

Implements org.jboss.jandex.IndexView.getClassesInPackage.

Returns all classes known to this index that are present in given package.
public Collection<ClassInfo>
getKnownClasses()

Implements org.jboss.jandex.IndexView.getKnownClasses.

Gets all known classes by this index (those which were scanned).
public Collection<ClassInfo>
getKnownDirectImplementors(final DotName
the super class of the desired subclasses
className
)

Implements org.jboss.jandex.IndexView.getKnownDirectImplementors.

Gets all known direct implementors of the specified interface.
public Set<ClassInfo>
getKnownDirectSubclasses(final DotName
the super class of the desired subclasses
className
)

Implements org.jboss.jandex.IndexView.getKnownDirectSubclasses.

Gets all known direct subclasses of the specified class.
public Collection<ClassInfo>
getKnownDirectSubinterfaces(DotName
the super interface of the desired subinterfaces
interfaceName
)

Implements org.jboss.jandex.IndexView.getKnownDirectSubinterfaces.

Gets all known direct subinterfaces of the specified interface.
private void
getKnownImplementors(DotName name, Set<ClassInfo> allKnown, Set<DotName> subInterfacesToProcess, Set<DotName> processedClasses)

public Collection<ModuleInfo>
getKnownModules()

Implements org.jboss.jandex.IndexView.getKnownModules.

Gets all known modules by this index (those which were scanned).
public Collection<ClassInfo>
getKnownUsers(DotName
the name of the class to look for
className
)

Implements org.jboss.jandex.IndexView.getKnownUsers.

Obtains a list of classes that use the specified class.
public ModuleInfo
getModuleByName(final DotName
the name of the module
moduleName
)

Implements org.jboss.jandex.IndexView.getModuleByName.

Gets the module that was scanned during the indexing phase.
public Set<DotName>
getSubpackages(DotName
package name in the common, dot-separated form (e.g. com.example.foobar); null means the unnamed package
packageName
)

Implements org.jboss.jandex.IndexView.getSubpackages.

Returns a set of packages known to this index that are direct subpackages of given package.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

indexesback to summary
pack-priv final Collection<IndexView> indexes

Constructor Detail

CompositeIndexback to summary
private CompositeIndex(final Collection<IndexView> indexes)

Method Detail

createback to summary
public static CompositeIndex create(Collection<IndexView> indexes)
createback to summary
public static CompositeIndex create(final IndexView... indexes)
createMergedback to summary
public static CompositeIndex createMerged(final CompositeIndex... indexes)
getAllKnownImplementorsback to summary
public Set<ClassInfo> getAllKnownImplementors(final DotName interfaceName)

Implements org.jboss.jandex.IndexView.getAllKnownImplementors.

Doc from org.jboss.jandex.IndexView.getAllKnownImplementors.

Returns all known classes that implement the given interface, directly and indirectly. This will return all classes that implement the interface and its subinterfaces, as well as subclasses of classes that implement the interface and its subinterfaces. (In short, it will return every class in the index that is assignable to the interface.)

Note that this method only returns classes. Unlike getKnownDirectImplementors(DotName), this method does not return subinterfaces of given interface.

Parameters
interfaceName:DotName

The interface

Returns:Set<ClassInfo>

All known implementors of the interface

Annotations
@Override
getAllKnownSubclassesback to summary
public Set<ClassInfo> getAllKnownSubclasses(final DotName className)

Implements org.jboss.jandex.IndexView.getAllKnownSubclasses.

Doc from org.jboss.jandex.IndexView.getAllKnownSubclasses.

Returns all known (including non-direct) subclasses of the given class. I.e., returns all known classes that are assignable to the given class.

Parameters
className:DotName

The class

Returns:Set<ClassInfo>

All known subclasses

Annotations
@Override
getAllKnownSubClassesback to summary
private void getAllKnownSubClasses(DotName className, Set<ClassInfo> allKnown, Set<DotName> processedClasses)
getAllKnownSubClassesback to summary
private void getAllKnownSubClasses(DotName name, Set<ClassInfo> allKnown, Set<DotName> subClassesToProcess, Set<DotName> processedClasses)
getAllKnownSubinterfacesback to summary
public Collection<ClassInfo> getAllKnownSubinterfaces(DotName interfaceName)

Implements org.jboss.jandex.IndexView.getAllKnownSubinterfaces.

Doc from org.jboss.jandex.IndexView.getAllKnownSubinterfaces.

Returns all known interfaces that extend the given interface, directly and indirectly. I.e., returns every interface in the index that is assignable to the given interface.

Parameters
interfaceName:DotName

The interace

Returns:Collection<ClassInfo>

all known subinterfaces

Annotations
@Override
getAnnotationsback to summary
public List<AnnotationInstance> getAnnotations(final DotName annotationName)

Implements org.jboss.jandex.IndexView.getAnnotations.

Doc from org.jboss.jandex.IndexView.getAnnotations.

Obtains a list of instances for the specified annotation. This is done using an O(1) lookup. Valid instance targets include field, method, parameter, and class.

Parameters
annotationName:DotName

the name of the annotation to look for

Returns:List<AnnotationInstance>

a non-null list of annotation instances

Annotations
@Override
getAnnotationsWithRepeatableback to summary
public Collection<AnnotationInstance> getAnnotationsWithRepeatable(DotName annotationName, IndexView index)

Implements org.jboss.jandex.IndexView.getAnnotationsWithRepeatable.

Doc from org.jboss.jandex.IndexView.getAnnotationsWithRepeatable.

Obtains a list of instances for the specified annotation. If the specified annotation is repeatable (JLS 9.6), the result also contains all values from all instances of the container annotation. In this case, the AnnotationInstance#target() returns the target of the container annotation instance.

Parameters
annotationName:DotName

the name of the repeatable annotation

index:IndexView

the index containing the annotation class

Returns:Collection<AnnotationInstance>

a non-null list of annotation instances

Annotations
@Override
getClassByNameback to summary
public ClassInfo getClassByName(final DotName className)

Implements org.jboss.jandex.IndexView.getClassByName.

Doc from org.jboss.jandex.IndexView.getClassByName.

Gets the class (or interface, or annotation) that was scanned during the indexing phase.

Parameters
className:DotName

the name of the class

Returns:ClassInfo

information about the class or null if it is not known

Annotations
@Override
getClassesInPackageback to summary
public Collection<ClassInfo> getClassesInPackage(DotName packageName)

Implements org.jboss.jandex.IndexView.getClassesInPackage.

Doc from org.jboss.jandex.IndexView.getClassesInPackage.

Returns all classes known to this index that are present in given package. Classes present in subpackages of given package are not returned. Classes present in the unnamed package may be looked up using null as the package name. If this index does not contain any class in given package, returns an empty collection.

In the default Index implementation, this information is not stored in the index initially. Instead, an index of classes by package name is constructed on demand (on the first invocation of this method).

Parameters
packageName:DotName

package name in the common, dot-separated form (e.g. com.example.foobar); null means the unnamed package

Returns:Collection<ClassInfo>

immutable collection of classes present in given package, never null

Annotations
@Override
getKnownClassesback to summary
public Collection<ClassInfo> getKnownClasses()

Implements org.jboss.jandex.IndexView.getKnownClasses.

Doc from org.jboss.jandex.IndexView.getKnownClasses.

Gets all known classes by this index (those which were scanned).

Returns:Collection<ClassInfo>

a collection of known classes

Annotations
@Override
getKnownDirectImplementorsback to summary
public Collection<ClassInfo> getKnownDirectImplementors(final DotName className)

Implements org.jboss.jandex.IndexView.getKnownDirectImplementors.

Doc from org.jboss.jandex.IndexView.getKnownDirectImplementors.

Gets all known direct implementors of the specified interface. A known direct implementor is one which was found during the scanning process; however, this is often not the complete universe of implementors, since typically indexes are constructed per jar. It is expected that several indexes will need to be searched when analyzing a jar that is a part of a complex multi-module/classloader environment (like an EE application server).

The list of implementors also includes direct subinterfaces. This is inconsistent with getAllKnownImplementors(DotName), which doesn't return subinterfaces.

Note that this will only pick up classes that directly implement given interface. It will not pick up classes implementing subinterfaces.

Parameters
className:DotName

the super class of the desired subclasses

Returns:Collection<ClassInfo>

a non-null list of all known subclasses of className

Annotations
@Override
getKnownDirectSubclassesback to summary
public Set<ClassInfo> getKnownDirectSubclasses(final DotName className)

Implements org.jboss.jandex.IndexView.getKnownDirectSubclasses.

Doc from org.jboss.jandex.IndexView.getKnownDirectSubclasses.

Gets all known direct subclasses of the specified class. A known direct subclass is one which was found during the scanning process; however, this is often not the complete universe of subclasses, since typically indexes are constructed per jar. It is expected that several indexes will need to be searched when analyzing a jar that is a part of a complex multi-module/classloader environment (like an EE application server).

Note that this will only pick up direct subclasses of the class. It will not pick up subclasses of subclasses.

Parameters
className:DotName

the super class of the desired subclasses

Returns:Set<ClassInfo>

a non-null list of all known subclasses of className

Annotations
@Override
getKnownDirectSubinterfacesback to summary
public Collection<ClassInfo> getKnownDirectSubinterfaces(DotName interfaceName)

Implements org.jboss.jandex.IndexView.getKnownDirectSubinterfaces.

Doc from org.jboss.jandex.IndexView.getKnownDirectSubinterfaces.

Gets all known direct subinterfaces of the specified interface. A known direct subinterface is one which was found during the scanning process; however, this is often not the complete universe of subinterfaces, since typically indexes are constructed per jar. It is expected that several indexes will need to be searched when analyzing a jar that is a part of a complex multi-module/classloader environment (like an EE application server).

Note that this will only pick up direct subinterfaces of the interface. It will not pick up subinterfaces of subinterfaces.

Parameters
interfaceName:DotName

the super interface of the desired subinterfaces

Returns:Collection<ClassInfo>

a non-null list of all known subinterfaces of interfaceName

Annotations
@Override
getKnownImplementorsback to summary
private void getKnownImplementors(DotName name, Set<ClassInfo> allKnown, Set<DotName> subInterfacesToProcess, Set<DotName> processedClasses)
getKnownModulesback to summary
public Collection<ModuleInfo> getKnownModules()

Implements org.jboss.jandex.IndexView.getKnownModules.

Doc from org.jboss.jandex.IndexView.getKnownModules.

Gets all known modules by this index (those which were scanned).

Returns:Collection<ModuleInfo>

a collection of known modules

Annotations
@Override
getKnownUsersback to summary
public Collection<ClassInfo> getKnownUsers(DotName className)

Implements org.jboss.jandex.IndexView.getKnownUsers.

Doc from org.jboss.jandex.IndexView.getKnownUsers.

Obtains a list of classes that use the specified class. In other words, a list of classes that include a reference to the specified class in their constant pool.

Parameters
className:DotName

the name of the class to look for

Returns:Collection<ClassInfo>

a non-null list of classes that use the specified class

Annotations
@Override
getModuleByNameback to summary
public ModuleInfo getModuleByName(final DotName moduleName)

Implements org.jboss.jandex.IndexView.getModuleByName.

Doc from org.jboss.jandex.IndexView.getModuleByName.

Gets the module that was scanned during the indexing phase.

Parameters
moduleName:DotName

the name of the module

Returns:ModuleInfo

information about the module or null if it is not known

Annotations
@Override
getSubpackagesback to summary
public Set<DotName> getSubpackages(DotName packageName)

Implements org.jboss.jandex.IndexView.getSubpackages.

Doc from org.jboss.jandex.IndexView.getSubpackages.

Returns a set of packages known to this index that are direct subpackages of given package. Indirect subpackages of given package (subpackages of subpackages) are not returned. If this index does not contain any class in a direct or indirect subpackage of given package, returns an empty collection.

Given that the unnamed package may not contain subpackages, passing null as the package name is permitted, but always results in an empty set.

In the default Index implementation, this information is not stored in the index initially. Instead, an index of packages is constructed on demand (on the first invocation of this method).

Parameters
packageName:DotName

package name in the common, dot-separated form (e.g. com.example.foobar); null means the unnamed package

Returns:Set<DotName>

immutable set of subpackages of given package, never null

Annotations
@Override