public class CompositeIndex extends Object implements IndexView
Index instances.
An example application is a Java EE deployment, which can contain multiple nested jars, each with
their own index.| Modifier and Type | Method and Description |
|---|---|
static CompositeIndex |
create(Collection<IndexView> indexes) |
static CompositeIndex |
create(IndexView... indexes) |
static CompositeIndex |
createMerged(CompositeIndex... indexes) |
Set<ClassInfo> |
getAllKnownImplementors(DotName interfaceName)
Returns all known classes that implement the given interface, directly and indirectly.
|
Set<ClassInfo> |
getAllKnownSubclasses(DotName className)
Returns all known (including non-direct) subclasses of the given class.
|
Collection<ClassInfo> |
getAllKnownSubinterfaces(DotName interfaceName)
Returns all known interfaces that extend the given interface, directly and indirectly.
|
List<AnnotationInstance> |
getAnnotations(DotName annotationName)
Obtains a list of instances for the specified annotation.
|
Collection<AnnotationInstance> |
getAnnotationsWithRepeatable(DotName annotationName,
IndexView index)
Obtains a list of instances for the specified annotation.
|
ClassInfo |
getClassByName(DotName className)
Gets the class (or interface, or annotation) that was scanned during the
indexing phase.
|
Collection<ClassInfo> |
getClassesInPackage(DotName packageName)
Returns all classes known to this index that are present in given package.
|
Collection<ClassInfo> |
getKnownClasses()
Gets all known classes by this index (those which were scanned).
|
Collection<ClassInfo> |
getKnownDirectImplementors(DotName className)
Gets all known direct implementors of the specified interface.
|
Set<ClassInfo> |
getKnownDirectSubclasses(DotName className)
Gets all known direct subclasses of the specified class.
|
Collection<ClassInfo> |
getKnownDirectSubinterfaces(DotName interfaceName)
Gets all known direct subinterfaces of the specified interface.
|
Collection<ModuleInfo> |
getKnownModules()
Gets all known modules by this index (those which were scanned).
|
Collection<ClassInfo> |
getKnownUsers(DotName className)
Obtains a list of classes that use the specified class.
|
ModuleInfo |
getModuleByName(DotName moduleName)
Gets the module that was scanned during the indexing phase.
|
Set<DotName> |
getSubpackages(DotName packageName)
Returns a set of packages known to this index that are direct subpackages of given package.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetAllKnownImplementors, getAllKnownImplementors, getAllKnownSubclasses, getAllKnownSubclasses, getAllKnownSubinterfaces, getAllKnownSubinterfaces, getAnnotations, getAnnotations, getAnnotationsWithRepeatable, getAnnotationsWithRepeatable, getClassByName, getClassByName, getClassesInPackage, getKnownDirectImplementors, getKnownDirectImplementors, getKnownDirectSubclasses, getKnownDirectSubclasses, getKnownDirectSubinterfaces, getKnownDirectSubinterfaces, getKnownUsers, getKnownUsers, getModuleByName, getSubpackagespublic static CompositeIndex create(Collection<IndexView> indexes)
public static CompositeIndex create(IndexView... indexes)
public static CompositeIndex createMerged(CompositeIndex... indexes)
public List<AnnotationInstance> getAnnotations(DotName annotationName)
getAnnotations in interface IndexViewannotationName - the name of the annotation to look forpublic Collection<AnnotationInstance> getAnnotationsWithRepeatable(DotName annotationName, IndexView index)
AnnotationInstance.target() returns the target of the container annotation instance.getAnnotationsWithRepeatable in interface IndexViewannotationName - the name of the repeatable annotationindex - the index containing the annotation classpublic Set<ClassInfo> getKnownDirectSubclasses(DotName className)
Note that this will only pick up direct subclasses of the class. It will not pick up subclasses of subclasses.
getKnownDirectSubclasses in interface IndexViewclassName - the super class of the desired subclassespublic Set<ClassInfo> getAllKnownSubclasses(DotName className)
getAllKnownSubclasses in interface IndexViewclassName - The classpublic Collection<ClassInfo> getKnownDirectSubinterfaces(DotName interfaceName)
Note that this will only pick up direct subinterfaces of the interface. It will not pick up subinterfaces of subinterfaces.
getKnownDirectSubinterfaces in interface IndexViewinterfaceName - the super interface of the desired subinterfacespublic Collection<ClassInfo> getAllKnownSubinterfaces(DotName interfaceName)
getAllKnownSubinterfaces in interface IndexViewinterfaceName - The interacepublic Collection<ClassInfo> getKnownDirectImplementors(DotName className)
The list of implementors also includes direct subinterfaces. This is inconsistent
with IndexView.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.
getKnownDirectImplementors in interface IndexViewclassName - the super class of the desired subclassespublic Set<ClassInfo> getAllKnownImplementors(DotName interfaceName)
Note that this method only returns classes. Unlike IndexView.getKnownDirectImplementors(DotName),
this method does not return subinterfaces of given interface.
getAllKnownImplementors in interface IndexViewinterfaceName - The interfacepublic ClassInfo getClassByName(DotName className)
getClassByName in interface IndexViewclassName - the name of the classpublic Collection<ClassInfo> getKnownClasses()
getKnownClasses in interface IndexViewpublic ModuleInfo getModuleByName(DotName moduleName)
getModuleByName in interface IndexViewmoduleName - the name of the modulepublic Collection<ModuleInfo> getKnownModules()
getKnownModules in interface IndexViewpublic Collection<ClassInfo> getKnownUsers(DotName className)
getKnownUsers in interface IndexViewclassName - the name of the class to look forpublic Collection<ClassInfo> getClassesInPackage(DotName packageName)
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).
getClassesInPackage in interface IndexViewpackageName - package name in the common, dot-separated form (e.g. com.example.foobar);
null means the unnamed packagenullpublic Set<DotName> getSubpackages(DotName packageName)
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).
getSubpackages in interface IndexViewpackageName - package name in the common, dot-separated form (e.g. com.example.foobar);
null means the unnamed packagenullCopyright © 2018–2022. All rights reserved.