public final class Index extends Object implements IndexView
It contains the following information:
Modifier and Type | Method and Description |
---|---|
static Index |
create(Map<DotName,List<AnnotationInstance>> annotations,
Map<DotName,List<ClassInfo>> subclasses,
Map<DotName,List<ClassInfo>> implementors,
Map<DotName,ClassInfo> classes)
Constructs a "mock" Index using the passed values.
|
Set<ClassInfo> |
getAllKnownImplementors(DotName interfaceName)
Returns all known classes that implement the given interface, directly and indirectly.
|
Collection<ClassInfo> |
getAllKnownSubclasses(DotName className)
Returns all known (including non-direct) sub classes of the given class.
|
List<AnnotationInstance> |
getAnnotations(DotName annotationName)
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> |
getKnownClasses()
Gets all known classes by this index (those which were scanned).
|
List<ClassInfo> |
getKnownDirectImplementors(DotName className)
Gets all known direct implementors of the specified interface name.
|
List<ClassInfo> |
getKnownDirectSubclasses(DotName className)
Gets all known direct subclasses of the specified class name.
|
void |
printAnnotations()
Print all annotations known by this index to stdout.
|
void |
printSubclasses()
Print all classes that have known subclasses, and all their subclasses
|
public static Index create(Map<DotName,List<AnnotationInstance>> annotations, Map<DotName,List<ClassInfo>> subclasses, Map<DotName,List<ClassInfo>> implementors, Map<DotName,ClassInfo> classes)
annotations
- A map to lookup annotation instances by class namesubclasses
- A map to lookup subclasses by super class nameimplementors
- A map to lookup implementing classes by interface nameclasses
- A map to lookup classes by class namepublic List<AnnotationInstance> getAnnotations(DotName annotationName)
getAnnotations
in interface IndexView
annotationName
- the name of the annotation to look forpublic List<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 IndexView
className
- the super class of the desired subclassespublic Collection<ClassInfo> getAllKnownSubclasses(DotName className)
IndexView
getAllKnownSubclasses
in interface IndexView
className
- The classpublic List<ClassInfo> getKnownDirectImplementors(DotName className)
The list of implementors may also include other methodParameters, in order to get a complete
list of all classes that are assignable to a given interface it is necessary to
recursively call IndexView.getKnownDirectImplementors(DotName)
for every implementing
interface found.
getKnownDirectImplementors
in interface IndexView
className
- the super class of the desired subclassespublic Set<ClassInfo> getAllKnownImplementors(DotName interfaceName)
IndexView
This will only return classes, not methodParameters.
getAllKnownImplementors
in interface IndexView
interfaceName
- The interfacepublic ClassInfo getClassByName(DotName className)
getClassByName
in interface IndexView
className
- the name of the classpublic Collection<ClassInfo> getKnownClasses()
getKnownClasses
in interface IndexView
public void printAnnotations()
public void printSubclasses()
Copyright © 2018 JBoss by Red Hat. All rights reserved.