Interface IndexView
-
- All Known Implementing Classes:
CompositeIndex
,EmptyIndex
,Index
,StackedIndex
public interface IndexView
The basic contract for accessing Jandex indexed information.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description static IndexView
empty()
Returns an immutable empty index; that is, an index that doesn't contain any class.default java.util.Collection<ClassInfo>
getAllKnownImplementations(java.lang.Class<?> interfaceClass)
Returns all known classes that implement the given interface, directly and indirectly.default java.util.Collection<ClassInfo>
getAllKnownImplementations(java.lang.String interfaceName)
Returns all known classes that implement the given interface, directly and indirectly.java.util.Collection<ClassInfo>
getAllKnownImplementations(DotName interfaceName)
Returns all known classes that implement the given interface, directly and indirectly.default java.util.Collection<ClassInfo>
getAllKnownImplementors(java.lang.Class<?> interfaceClass)
Deprecated.default java.util.Collection<ClassInfo>
getAllKnownImplementors(java.lang.String interfaceName)
Deprecated.java.util.Collection<ClassInfo>
getAllKnownImplementors(DotName interfaceName)
Deprecated.default java.util.Collection<ClassInfo>
getAllKnownSubclasses(java.lang.Class<?> clazz)
Returns all known subclasses of the given class, direct and indirect.default java.util.Collection<ClassInfo>
getAllKnownSubclasses(java.lang.String className)
Returns all known subclasses of the given class, direct and indirect.java.util.Collection<ClassInfo>
getAllKnownSubclasses(DotName className)
Returns all known subclasses of the given class, direct and indirect.default java.util.Collection<ClassInfo>
getAllKnownSubinterfaces(java.lang.Class<?> interfaceClass)
Returns all known subinterfaces of the given interface, direct and indirect.default java.util.Collection<ClassInfo>
getAllKnownSubinterfaces(java.lang.String interfaceName)
Returns all known interfaces that extend the given interface, directly and indirectly.java.util.Collection<ClassInfo>
getAllKnownSubinterfaces(DotName interfaceName)
Returns all known subinterfaces of the given interface, direct and indirect.default java.util.Collection<AnnotationInstance>
getAnnotations(java.lang.Class<?> annotationType)
Obtains a list of instances for the specified annotation.default java.util.Collection<AnnotationInstance>
getAnnotations(java.lang.String annotationName)
Obtains a list of instances for the specified annotation.java.util.Collection<AnnotationInstance>
getAnnotations(DotName annotationName)
Obtains a list of instances for the specified annotation.default java.util.Collection<AnnotationInstance>
getAnnotationsWithRepeatable(java.lang.Class<?> annotationType, IndexView index)
Obtains a list of instances for the specified annotation.default java.util.Collection<AnnotationInstance>
getAnnotationsWithRepeatable(java.lang.String annotationName, IndexView index)
Obtains a list of instances for the specified annotation.java.util.Collection<AnnotationInstance>
getAnnotationsWithRepeatable(DotName annotationName, IndexView index)
Obtains a list of instances for the specified annotation.default ClassInfo
getClassByName(java.lang.Class<?> clazz)
Returns the class (or enum, record, interface, annotation) with given name (clazz.getName()
).default ClassInfo
getClassByName(java.lang.String className)
Returns the class (or enum, record, interface, annotation) with given name.ClassInfo
getClassByName(DotName className)
Returns the class (or enum, record, interface, annotation) with given name.default java.util.Collection<ClassInfo>
getClassesInPackage(java.lang.String packageName)
Returns all classes known to this index that are present in given package.java.util.Collection<ClassInfo>
getClassesInPackage(DotName packageName)
Returns all classes known to this index that are present in given package.java.util.Collection<ClassInfo>
getKnownClasses()
Gets all known classes by this index (those which were scanned).default java.util.Collection<ClassInfo>
getKnownDirectImplementations(java.lang.Class<?> interfaceClass)
Returns all known classes that directly implement the given interface.default java.util.Collection<ClassInfo>
getKnownDirectImplementations(java.lang.String interfaceName)
Returns all known classes that directly implement the given interface.java.util.Collection<ClassInfo>
getKnownDirectImplementations(DotName interfaceName)
Returns all known classes that directly implement the given interface.default java.util.Collection<ClassInfo>
getKnownDirectImplementors(java.lang.Class<?> interfaceClass)
Deprecated.default java.util.Collection<ClassInfo>
getKnownDirectImplementors(java.lang.String interfaceName)
Deprecated.java.util.Collection<ClassInfo>
getKnownDirectImplementors(DotName interfaceName)
Deprecated.default java.util.Collection<ClassInfo>
getKnownDirectSubclasses(java.lang.Class<?> clazz)
Returns all known direct subclasses of the given class.default java.util.Collection<ClassInfo>
getKnownDirectSubclasses(java.lang.String className)
Returns all known direct subclasses of the given class.java.util.Collection<ClassInfo>
getKnownDirectSubclasses(DotName className)
Returns all known direct subclasses of the given class.default java.util.Collection<ClassInfo>
getKnownDirectSubinterfaces(java.lang.Class<?> interfaceClass)
Returns all known direct subinterfaces of the given interface.default java.util.Collection<ClassInfo>
getKnownDirectSubinterfaces(java.lang.String interfaceName)
Returns all known direct subinterfaces of the given interface.java.util.Collection<ClassInfo>
getKnownDirectSubinterfaces(DotName interfaceName)
Returns all known direct subinterfaces of the given interface.java.util.Collection<ModuleInfo>
getKnownModules()
Gets all known modules by this index (those which were scanned).default java.util.Collection<ClassInfo>
getKnownUsers(java.lang.Class<?> clazz)
Returns a list of classes in this index that use the specified class.default java.util.Collection<ClassInfo>
getKnownUsers(java.lang.String className)
Returns a list of classes in this index that use the specified class.java.util.Collection<ClassInfo>
getKnownUsers(DotName className)
Returns a list of classes in this index that use the specified class.default ModuleInfo
getModuleByName(java.lang.String moduleName)
Gets the module that was scanned during the indexing phase.ModuleInfo
getModuleByName(DotName moduleName)
Gets the module that was scanned during the indexing phase.default java.util.Set<DotName>
getSubpackages(java.lang.String packageName)
Returns a set of packages known to this index that are direct subpackages of given package.java.util.Set<DotName>
getSubpackages(DotName packageName)
Returns a set of packages known to this index that are direct subpackages of given package.
-
-
-
Method Detail
-
empty
static IndexView empty()
Returns an immutable empty index; that is, an index that doesn't contain any class. All methods return either an empty collection, ornull
.- Since:
- 3.2.0
-
getKnownClasses
java.util.Collection<ClassInfo> getKnownClasses()
Gets all known classes by this index (those which were scanned).- Returns:
- immutable collection of known classes, never
null
-
getClassByName
ClassInfo getClassByName(DotName className)
Returns the class (or enum, record, interface, annotation) with given name. Returnsnull
if class with given name is not present in the index.- Parameters:
className
- the name of the class- Returns:
- information about the class or
null
if it is not known
-
getClassByName
default ClassInfo getClassByName(java.lang.String className)
Returns the class (or enum, record, interface, annotation) with given name. Returnsnull
if class with given name is not present in the index.- Parameters:
className
- the name of the class- Returns:
- information about the class or
null
if it is not known
-
getClassByName
default ClassInfo getClassByName(java.lang.Class<?> clazz)
Returns the class (or enum, record, interface, annotation) with given name (clazz.getName()
). Returnsnull
if class with given name is not present in the index.- Parameters:
clazz
- the class- Returns:
- information about the class or
null
if it is not known
-
getKnownDirectSubclasses
java.util.Collection<ClassInfo> getKnownDirectSubclasses(DotName className)
Returns all known direct subclasses of the given class. Indirect subclasses are not returned.Note that interfaces are considered direct subclasses of
java.lang.Object
.- Parameters:
className
- the class- Returns:
- an immutable collection of known direct subclasses of given class, never
null
-
getKnownDirectSubclasses
default java.util.Collection<ClassInfo> getKnownDirectSubclasses(java.lang.String className)
Returns all known direct subclasses of the given class. Indirect subclasses are not returned.Note that interfaces are considered direct subclasses of
java.lang.Object
.- Parameters:
className
- the class- Returns:
- an immutable collection of known direct subclasses of given class, never
null
-
getKnownDirectSubclasses
default java.util.Collection<ClassInfo> getKnownDirectSubclasses(java.lang.Class<?> clazz)
Returns all known direct subclasses of the given class. Indirect subclasses are not returned.Note that interfaces are considered direct subclasses of
java.lang.Object
.- Parameters:
clazz
- the class- Returns:
- an immutable collection of known direct subclasses of given class, never
null
-
getAllKnownSubclasses
java.util.Collection<ClassInfo> getAllKnownSubclasses(DotName className)
Returns all known subclasses of the given class, direct and indirect. In other words, all classes that are assignable to the given class.- Parameters:
className
- the class- Returns:
- immutable collection of all known subclasses of given class, never
null
-
getAllKnownSubclasses
default java.util.Collection<ClassInfo> getAllKnownSubclasses(java.lang.String className)
Returns all known subclasses of the given class, direct and indirect. In other words, all classes that are assignable to the given class.- Parameters:
className
- the class- Returns:
- immutable collection of all known subclasses of given class, never
null
-
getAllKnownSubclasses
default java.util.Collection<ClassInfo> getAllKnownSubclasses(java.lang.Class<?> clazz)
Returns all known subclasses of the given class, direct and indirect. In other words, all classes that are assignable to the given class.- Parameters:
clazz
- the class- Returns:
- immutable collection of all known subclasses of given class, never
null
-
getKnownDirectSubinterfaces
java.util.Collection<ClassInfo> getKnownDirectSubinterfaces(DotName interfaceName)
Returns all known direct subinterfaces of the given interface. Indirect subinterfaces are not returned.- Parameters:
interfaceName
- the interface- Returns:
- immutable collection of all known subinterfaces of given interface, never
null
- Since:
- 3.0
-
getKnownDirectSubinterfaces
default java.util.Collection<ClassInfo> getKnownDirectSubinterfaces(java.lang.String interfaceName)
Returns all known direct subinterfaces of the given interface. Indirect subinterfaces are not returned.- Parameters:
interfaceName
- the interface- Returns:
- immutable collection of all known subinterfaces of given interface, never
null
- Since:
- 3.0
-
getKnownDirectSubinterfaces
default java.util.Collection<ClassInfo> getKnownDirectSubinterfaces(java.lang.Class<?> interfaceClass)
Returns all known direct subinterfaces of the given interface. Indirect subinterfaces are not returned.- Parameters:
interfaceClass
- the interface- Returns:
- immutable collection of all known subinterfaces of given interface, never
null
- Since:
- 3.0
-
getAllKnownSubinterfaces
java.util.Collection<ClassInfo> getAllKnownSubinterfaces(DotName interfaceName)
Returns all known subinterfaces of the given interface, direct and indirect. In other words, all interfaces that are assignable to the given interface.- Parameters:
interfaceName
- the interface- Returns:
- immutable collection of all known subinterfaces of given interface, never
null
- Since:
- 3.0
-
getAllKnownSubinterfaces
default java.util.Collection<ClassInfo> getAllKnownSubinterfaces(java.lang.String interfaceName)
Returns all known interfaces that extend the given interface, directly and indirectly. In other words, all interfaces in the index that are assignable to the given interface.- Parameters:
interfaceName
- The interface- Returns:
- all known subinterfaces
- Since:
- 3.0
-
getAllKnownSubinterfaces
default java.util.Collection<ClassInfo> getAllKnownSubinterfaces(java.lang.Class<?> interfaceClass)
Returns all known subinterfaces of the given interface, direct and indirect. In other words, all interfaces that are assignable to the given interface.- Parameters:
interfaceClass
- the interface- Returns:
- immutable collection of all known subinterfaces of given interface, never
null
- Since:
- 3.0
-
getKnownDirectImplementations
java.util.Collection<ClassInfo> getKnownDirectImplementations(DotName interfaceName)
Returns all known classes that directly implement the given interface. Classes that do not directly implement the given interface but do directly implement subinterfaces are not returned. Subclasses of classes that directly implement the given interface are not returned either.Note that unlike
getKnownDirectImplementors(DotName)
, this method does NOT return direct subinterfaces of the given interface, which is typically what you expect when you call this method.- Parameters:
interfaceName
- the interface- Returns:
- immutable collection of all known direct implementations of the interface, never
null
-
getKnownDirectImplementations
default java.util.Collection<ClassInfo> getKnownDirectImplementations(java.lang.String interfaceName)
Returns all known classes that directly implement the given interface. Classes that do not directly implement the given interface but do directly implement subinterfaces are not returned. Subclasses of classes that directly implement the given interface are not returned either.Note that unlike
getKnownDirectImplementors(DotName)
, this method does NOT return direct subinterfaces of the given interface, which is typically what you expect when you call this method.- Parameters:
interfaceName
- the interface- Returns:
- immutable collection of all known direct implementations of the interface, never
null
-
getKnownDirectImplementations
default java.util.Collection<ClassInfo> getKnownDirectImplementations(java.lang.Class<?> interfaceClass)
Returns all known classes that directly implement the given interface. Classes that do not directly implement the given interface but do directly implement subinterfaces are not returned. Subclasses of classes that directly implement the given interface are not returned either.Note that unlike
getKnownDirectImplementors(DotName)
, this method does NOT return direct subinterfaces of the given interface, which is typically what you expect when you call this method.- Parameters:
interfaceClass
- the interface- Returns:
- immutable collection of all known direct implementations of the interface, never
null
-
getAllKnownImplementations
java.util.Collection<ClassInfo> getAllKnownImplementations(DotName interfaceName)
Returns all known classes that implement the given interface, directly and indirectly. That is, all classes that implement the interface and its subinterfaces, as well as all their subclasses. In other words, all classes that are assignable to the interface.- Parameters:
interfaceName
- the interface- Returns:
- immutable collection of all known implementations of the interface, never
null
-
getAllKnownImplementations
default java.util.Collection<ClassInfo> getAllKnownImplementations(java.lang.String interfaceName)
Returns all known classes that implement the given interface, directly and indirectly. That is, all classes that implement the interface and its subinterfaces, as well as all their subclasses. In other words, all classes that are assignable to the interface.- Parameters:
interfaceName
- the interface- Returns:
- immutable collection of all known implementations of the interface, never
null
-
getAllKnownImplementations
default java.util.Collection<ClassInfo> getAllKnownImplementations(java.lang.Class<?> interfaceClass)
Returns all known classes that implement the given interface, directly and indirectly. That is, all classes that implement the interface and its subinterfaces, as well as all their subclasses. In other words, all classes that are assignable to the interface.- Parameters:
interfaceClass
- the interface- Returns:
- immutable collection of all known implementations of the interface, never
null
-
getKnownDirectImplementors
@Deprecated java.util.Collection<ClassInfo> getKnownDirectImplementors(DotName interfaceName)
Deprecated.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:
interfaceName
- The interface- Returns:
- All known direct implementors of the interface
-
getKnownDirectImplementors
@Deprecated default java.util.Collection<ClassInfo> getKnownDirectImplementors(java.lang.String interfaceName)
Deprecated.Gets all known direct implementors of the specified interface name. 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(String)
, 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:
interfaceName
- The interface- Returns:
- All known direct implementors of the interface
-
getKnownDirectImplementors
@Deprecated default java.util.Collection<ClassInfo> getKnownDirectImplementors(java.lang.Class<?> interfaceClass)
Deprecated.Gets all known direct implementors of the specified interface name. 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(Class)
, 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:
interfaceClass
- The interface- Returns:
- All known direct implementors of the interface
-
getAllKnownImplementors
@Deprecated java.util.Collection<ClassInfo> getAllKnownImplementors(DotName interfaceName)
Deprecated.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
- The interface- Returns:
- All known implementors of the interface
-
getAllKnownImplementors
@Deprecated default java.util.Collection<ClassInfo> getAllKnownImplementors(java.lang.String interfaceName)
Deprecated.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(String)
, this method does not return subinterfaces of given interface.- Parameters:
interfaceName
- The interface- Returns:
- All known implementors of the interface
-
getAllKnownImplementors
@Deprecated default java.util.Collection<ClassInfo> getAllKnownImplementors(java.lang.Class<?> interfaceClass)
Deprecated.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(Class)
, this method does not return subinterfaces of given interface.- Parameters:
interfaceClass
- The interface- Returns:
- All known implementors of the interface
-
getAnnotations
java.util.Collection<AnnotationInstance> getAnnotations(DotName annotationName)
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
- the name of the annotation to look for- Returns:
- immutable collection of annotation instances, never
null
-
getAnnotations
default java.util.Collection<AnnotationInstance> getAnnotations(java.lang.String annotationName)
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
- the name of the annotation to look for- Returns:
- immutable collection of annotation instances, never
null
-
getAnnotations
default java.util.Collection<AnnotationInstance> getAnnotations(java.lang.Class<?> annotationType)
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:
annotationType
- the type of the annotation to look for- Returns:
- immutable collection of annotation instances, never
null
-
getAnnotationsWithRepeatable
java.util.Collection<AnnotationInstance> getAnnotationsWithRepeatable(DotName annotationName, IndexView index)
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, theAnnotationInstance.target()
returns the target of the container annotation instance.- Parameters:
annotationName
- the name of the repeatable annotationindex
- the index containing the annotation class- Returns:
- immutable collection of annotation instances, never
null
- Throws:
java.lang.IllegalArgumentException
- If the index does not contain the annotation definition or if it does not represent an annotation type
-
getAnnotationsWithRepeatable
default java.util.Collection<AnnotationInstance> getAnnotationsWithRepeatable(java.lang.String annotationName, IndexView index)
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, theAnnotationInstance.target()
returns the target of the container annotation instance.- Parameters:
annotationName
- the name of the repeatable annotationindex
- the index containing the annotation class- Returns:
- immutable collection of annotation instances, never
null
- Throws:
java.lang.IllegalArgumentException
- If the index does not contain the annotation definition or if it does not represent an annotation type
-
getAnnotationsWithRepeatable
default java.util.Collection<AnnotationInstance> getAnnotationsWithRepeatable(java.lang.Class<?> annotationType, IndexView index)
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, theAnnotationInstance.target()
returns the target of the container annotation instance.- Parameters:
annotationType
- the name of the repeatable annotationindex
- the index containing the annotation class- Returns:
- immutable collection of annotation instances, never
null
- Throws:
java.lang.IllegalArgumentException
- If the index does not contain the annotation definition or if it does not represent an annotation type
-
getKnownModules
java.util.Collection<ModuleInfo> getKnownModules()
Gets all known modules by this index (those which were scanned).- Returns:
- immutable collection of known modules, never
null
-
getModuleByName
ModuleInfo getModuleByName(DotName moduleName)
Gets the module that was scanned during the indexing phase.- Parameters:
moduleName
- the name of the module- Returns:
- information about the module or
null
if it is not known
-
getModuleByName
default ModuleInfo getModuleByName(java.lang.String moduleName)
Gets the module that was scanned during the indexing phase.- Parameters:
moduleName
- the name of the module- Returns:
- information about the module or
null
if it is not known
-
getKnownUsers
java.util.Collection<ClassInfo> getKnownUsers(DotName className)
Returns a list of classes in this index that use the specified class. For one class to use another class, the other class has to:- occur in the signature of the class (that is, in the superclass type, in the superinterface types, in the type parameters, or in the list of permitted subclasses), or
- occur in the signature of any of the class's methods (that is, in the return type, in the parameter types, in the exception types, or in the type parameters), or
- occur in the type of any of the class's fields or record components, or
- occur in the list of class references in the constant pool, as described by the JLS and JVMS.
- Parameters:
className
- the name of the class to look for- Returns:
- immutable collection of classes that use the specified class, never
null
-
getKnownUsers
default java.util.Collection<ClassInfo> getKnownUsers(java.lang.String className)
Returns a list of classes in this index that use the specified class. For one class to use another class, the other class has to:- occur in the signature of the class (that is, in the superclass type, in the superinterface types, in the type parameters, or in the list of permitted subclasses), or
- occur in the signature of any of the class's methods (that is, in the return type, in the parameter types, in the exception types, or in the type parameters), or
- occur in the type of any of the class's fields or record components, or
- occur in the list of class references in the constant pool, as described by the JLS and JVMS.
- Parameters:
className
- the name of the class to look for- Returns:
- immutable collection of classes that use the specified class, never
null
-
getKnownUsers
default java.util.Collection<ClassInfo> getKnownUsers(java.lang.Class<?> clazz)
Returns a list of classes in this index that use the specified class. For one class to use another class, the other class has to:- occur in the signature of the class (that is, in the superclass type, in the superinterface types, in the type parameters, or in the list of permitted subclasses), or
- occur in the signature of any of the class's methods (that is, in the return type, in the parameter types, in the exception types, or in the type parameters), or
- occur in the type of any of the class's fields or record components, or
- occur in the list of class references in the constant pool of the class, as described by the JLS and JVMS.
- Parameters:
clazz
- the class to look for- Returns:
- immutable collection of classes that use the specified class, never
null
-
getClassesInPackage
java.util.Collection<ClassInfo> getClassesInPackage(DotName packageName)
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 usingnull
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
- package name in the common, dot-separated form (e.g.com.example.foobar
);null
means the unnamed package- Returns:
- immutable collection of classes present in given package, never
null
- Since:
- 3.0
-
getClassesInPackage
default java.util.Collection<ClassInfo> getClassesInPackage(java.lang.String packageName)
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 usingnull
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
- package name in the common, dot-separated form (e.g.com.example.foobar
);null
means the unnamed package- Returns:
- immutable collection of classes present in given package, never
null
- Since:
- 3.0
-
getSubpackages
java.util.Set<DotName> getSubpackages(DotName packageName)
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
- package name in the common, dot-separated form (e.g.com.example.foobar
);null
means the unnamed package- Returns:
- immutable set of subpackages of given package, never
null
- Since:
- 3.0
-
getSubpackages
default java.util.Set<DotName> getSubpackages(java.lang.String packageName)
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
- package name in the common, dot-separated form (e.g.com.example.foobar
);null
means the unnamed package- Returns:
- immutable set of subpackages of given package, never
null
- Since:
- 3.0
-
-