Package io.github.classgraph
Class PackageInfo
- java.lang.Object
-
- io.github.classgraph.PackageInfo
-
- All Implemented Interfaces:
Comparable<PackageInfo>
public class PackageInfo extends Object implements Comparable<PackageInfo>
Holds metadata about a package encountered during a scan.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(PackageInfo o)
boolean
equals(Object o)
AnnotationInfoList
getAnnotationInfo()
Get any annotations on thepackage-info.class
file.AnnotationInfo
getAnnotationInfo(String annotationName)
Get a the named annotation on this package, or null if the package does not have the named annotation.List<PackageInfo>
getChildren()
The child packages of this package, or the empty list if none.ClassInfoList
getClassInfo()
Get theClassInfo
objects for all classes that are members of this package.ClassInfo
getClassInfo(String className)
Get theClassInfo
object for the named class in this package, or null if the class was not found in this module.ClassInfoList
getClassInfoRecursive()
Get theClassInfo
objects for all classes that are members of this package or a sub-package.String
getName()
The package name ("" for the root package).static PackageInfo
getPackage(String packageName, Map<String,PackageInfo> packageNameToPackageInfo)
Get thePackageInfo
object for the named package, also creatingPackageInfo
objects for any needed parent packages.PackageInfo
getParent()
The parent package of this package, or null if this is the root package.boolean
hasAnnotation(String annotationName)
int
hashCode()
String
toString()
-
-
-
Method Detail
-
getName
public String getName()
The package name ("" for the root package).
-
getAnnotationInfo
public AnnotationInfo getAnnotationInfo(String annotationName)
Get a the named annotation on this package, or null if the package does not have the named annotation.- Parameters:
annotationName
- The annotation name.- Returns:
- An
AnnotationInfo
object representing the named annotation on this package, or null if the package does not have the named annotation.
-
getAnnotationInfo
public AnnotationInfoList getAnnotationInfo()
Get any annotations on thepackage-info.class
file.
-
hasAnnotation
public boolean hasAnnotation(String annotationName)
- Parameters:
annotationName
- The name of an annotation.- Returns:
- true if this package has the named annotation.
-
getParent
public PackageInfo getParent()
The parent package of this package, or null if this is the root package.
-
getChildren
public List<PackageInfo> getChildren()
The child packages of this package, or the empty list if none.
-
getClassInfo
public ClassInfo getClassInfo(String className)
Get theClassInfo
object for the named class in this package, or null if the class was not found in this module.
-
getClassInfo
public ClassInfoList getClassInfo()
Get theClassInfo
objects for all classes that are members of this package.
-
getClassInfoRecursive
public ClassInfoList getClassInfoRecursive()
Get theClassInfo
objects for all classes that are members of this package or a sub-package.
-
getPackage
public static PackageInfo getPackage(String packageName, Map<String,PackageInfo> packageNameToPackageInfo)
Get thePackageInfo
object for the named package, also creatingPackageInfo
objects for any needed parent packages.
-
compareTo
public int compareTo(PackageInfo o)
- Specified by:
compareTo
in interfaceComparable<PackageInfo>
-
-