Package io.github.classgraph
Class ModuleInfo
java.lang.Object
io.github.classgraph.ModuleInfo
- All Implemented Interfaces:
HasName
,Comparable<ModuleInfo>
Holds metadata about a package encountered during a scan.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate AnnotationInfoList
AnnotationInfo
objects for any annotations on the module-info.class file, if present, else null.private Set
<AnnotationInfo> UniqueAnnotationInfo
objects for any annotations on the module-info.class file, if present, else null.Set of classes in the module.private ClasspathElement
The classpath element.private URI
The location of the module as a URI.private ModuleRef
TheModuleRef
.private String
The name of the module.private Set
<PackageInfo> PackageInfo
objects for packages found within the class, if any, else null. -
Constructor Summary
ConstructorsConstructorDescriptionDeerialization constructor.ModuleInfo
(ModuleRef moduleRef, ClasspathElement classpathElement) Construct a ModuleInfo object. -
Method Summary
Modifier and TypeMethodDescription(package private) void
addAnnotations
(AnnotationInfoList moduleAnnotations) Add annotations found in a module descriptor classfile.(package private) void
addClassInfo
(ClassInfo classInfo) Add aClassInfo
object to thisModuleInfo
.(package private) void
addPackageInfo
(PackageInfo packageInfo) Add aPackageInfo
object to thisModuleInfo
.int
compareTo
(ModuleInfo other) boolean
Get any annotations on thepackage-info.class
file.getAnnotationInfo
(Class<? extends Annotation> annotation) Get a the annotation on this module, or null if the module does not have the annotation.getAnnotationInfo
(String annotationName) Get a the named annotation on this module, or null if the module does not have the named annotation.Get the list ofClassInfo
objects for all classes that are members of this package.getClassInfo
(String className) Get theClassInfo
object for the named class in this module, or null if the class was not found in this module.The module location, or null for modules whose location is unknown.TheModuleRef
for this module, or null if this module was obtained from a classpath element on the traditional classpath that contained amodule-info.class
file.getName()
The module name, or""
for the unnamed module.Get thePackageInfo
objects for all packages that are members of this module.getPackageInfo
(String packageName) Get thePackageInfo
object for the named package in this module, or null if the package was not found in this module.boolean
hasAnnotation
(Class<? extends Annotation> annotation) Check if this module has the annotation.boolean
hasAnnotation
(String annotationName) Check if this module has the named annotation.int
hashCode()
toString()
-
Field Details
-
name
The name of the module. -
classpathElement
The classpath element. -
moduleRef
TheModuleRef
. -
locationURI
The location of the module as a URI. -
annotationInfoSet
UniqueAnnotationInfo
objects for any annotations on the module-info.class file, if present, else null. -
annotationInfo
AnnotationInfo
objects for any annotations on the module-info.class file, if present, else null. -
packageInfoSet
PackageInfo
objects for packages found within the class, if any, else null. -
classInfoSet
Set of classes in the module.
-
-
Constructor Details
-
ModuleInfo
ModuleInfo()Deerialization constructor. -
ModuleInfo
ModuleInfo(ModuleRef moduleRef, ClasspathElement classpathElement) Construct a ModuleInfo object.- Parameters:
moduleRef
- the module refclasspathElement
- the classpath element
-
-
Method Details
-
getName
The module name, or""
for the unnamed module. -
getLocation
The module location, or null for modules whose location is unknown.- Returns:
- the module location, or null for modules whose location is unknown.
-
getModuleRef
TheModuleRef
for this module, or null if this module was obtained from a classpath element on the traditional classpath that contained amodule-info.class
file.- Returns:
- the
ModuleRef
, or null if this module was obtained from a classpath element on the traditional classpath that contained amodule-info.class
file.
-
addClassInfo
Add aClassInfo
object to thisModuleInfo
.- Parameters:
classInfo
- theClassInfo
object to add
-
getClassInfo
Get theClassInfo
object for the named class in this module, or null if the class was not found in this module.- Parameters:
className
- the class name- Returns:
- the
ClassInfo
object for the named class in this module, or null if the class was not found in this module.
-
getClassInfo
Get the list ofClassInfo
objects for all classes that are members of this package.- Returns:
- the list of
ClassInfo
objects for all classes that are members of this package.
-
addPackageInfo
Add aPackageInfo
object to thisModuleInfo
.- Parameters:
packageInfo
- thePackageInfo
object
-
getPackageInfo
Get thePackageInfo
object for the named package in this module, or null if the package was not found in this module.- Parameters:
packageName
- the package name- Returns:
- the
PackageInfo
object for the named package in this module, or null if the package was not found in this module.
-
getPackageInfo
Get thePackageInfo
objects for all packages that are members of this module.- Returns:
- the list of
PackageInfo
objects for all packages that are members of this module.
-
addAnnotations
Add annotations found in a module descriptor classfile.- Parameters:
moduleAnnotations
- the module annotations
-
getAnnotationInfo
Get a the annotation on this module, or null if the module does not have the annotation.- Parameters:
annotation
- The annotation.- Returns:
- An
AnnotationInfo
object representing the annotation on this module, or null if the module does not have the annotation.
-
getAnnotationInfo
Get a the named annotation on this module, or null if the module does not have the named annotation.- Parameters:
annotationName
- The annotation name.- Returns:
- An
AnnotationInfo
object representing the named annotation on this module, or null if the module does not have the named annotation.
-
getAnnotationInfo
Get any annotations on thepackage-info.class
file.- Returns:
- the list of
AnnotationInfo
objects for annotations on thepackage-info.class
file.
-
hasAnnotation
Check if this module has the annotation.- Parameters:
annotation
- The annotation.- Returns:
- true if this module has the annotation.
-
hasAnnotation
Check if this module has the named annotation.- Parameters:
annotationName
- The name of an annotation.- Returns:
- true if this module has the named annotation.
-
compareTo
- Specified by:
compareTo
in interfaceComparable<ModuleInfo>
-
hashCode
public int hashCode() -
equals
-
toString
-