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 AnnotationInfoListAnnotationInfoobjects for any annotations on the module-info.class file, if present, else null.private Set<AnnotationInfo> UniqueAnnotationInfoobjects for any annotations on the module-info.class file, if present, else null.Set of classes in the module.private ClasspathElementThe classpath element.private URIThe location of the module as a URI.private ModuleRefTheModuleRef.private StringThe name of the module.private Set<PackageInfo> PackageInfoobjects 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) voidaddAnnotations(AnnotationInfoList moduleAnnotations) Add annotations found in a module descriptor classfile.(package private) voidaddClassInfo(ClassInfo classInfo) Add aClassInfoobject to thisModuleInfo.(package private) voidaddPackageInfo(PackageInfo packageInfo) Add aPackageInfoobject to thisModuleInfo.intcompareTo(ModuleInfo other) booleanGet any annotations on thepackage-info.classfile.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 ofClassInfoobjects for all classes that are members of this package.getClassInfo(String className) Get theClassInfoobject 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.TheModuleReffor this module, or null if this module was obtained from a classpath element on the traditional classpath that contained amodule-info.classfile.getName()The module name, or""for the unnamed module.Get thePackageInfoobjects for all packages that are members of this module.getPackageInfo(String packageName) Get thePackageInfoobject for the named package in this module, or null if the package was not found in this module.booleanhasAnnotation(Class<? extends Annotation> annotation) Check if this module has the annotation.booleanhasAnnotation(String annotationName) Check if this module has the named annotation.inthashCode()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
UniqueAnnotationInfoobjects for any annotations on the module-info.class file, if present, else null. -
annotationInfo
AnnotationInfoobjects for any annotations on the module-info.class file, if present, else null. -
packageInfoSet
PackageInfoobjects 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
TheModuleReffor this module, or null if this module was obtained from a classpath element on the traditional classpath that contained amodule-info.classfile.- Returns:
- the
ModuleRef, or null if this module was obtained from a classpath element on the traditional classpath that contained amodule-info.classfile.
-
addClassInfo
Add aClassInfoobject to thisModuleInfo.- Parameters:
classInfo- theClassInfoobject to add
-
getClassInfo
Get theClassInfoobject 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
ClassInfoobject for the named class in this module, or null if the class was not found in this module.
-
getClassInfo
Get the list ofClassInfoobjects for all classes that are members of this package.- Returns:
- the list of
ClassInfoobjects for all classes that are members of this package.
-
addPackageInfo
Add aPackageInfoobject to thisModuleInfo.- Parameters:
packageInfo- thePackageInfoobject
-
getPackageInfo
Get thePackageInfoobject 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
PackageInfoobject for the named package in this module, or null if the package was not found in this module.
-
getPackageInfo
Get thePackageInfoobjects for all packages that are members of this module.- Returns:
- the list of
PackageInfoobjects 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
AnnotationInfoobject 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
AnnotationInfoobject 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.classfile.- Returns:
- the list of
AnnotationInfoobjects for annotations on thepackage-info.classfile.
-
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:
compareToin interfaceComparable<ModuleInfo>
-
hashCode
public int hashCode() -
equals
-
toString
-