Top Description Inners Fields Constructors Methods
io.github.classgraph

public Class ClassInfo

extends ScanResultObject
implements Comparable<ClassInfo>, HasName
Class Inheritance
All Implemented Interfaces
io.github.classgraph.HasName, java.lang.Comparable
Known Direct Subclasses
io.github.classgraph.ArrayClassInfo
Imports
java.io.File, java.lang.annotation.Annotation, .Inherited, .Repeatable, java.lang.reflect.Modifier, java.net.MalformedURLException, .URI, .URL, java.util.AbstractMap.SimpleEntry, .ArrayList, .Collection, .Collections, .EnumMap, .HashSet, .LinkedHashSet, .LinkedList, .List, .Map, .Map.Entry, .Set, io.github.classgraph.Classfile.ClassContainment, .Classfile.ClassTypeAnnotationDecorator, .FieldInfoList.FieldInfoFilter, nonapi.io.github.classgraph.json.Id, nonapi.io.github.classgraph.reflection.ReflectionUtils, nonapi.io.github.classgraph.scanspec.ScanSpec, nonapi.io.github.classgraph.types.ParseException, .Parser, .TypeUtils, .TypeUtils.ModifierType, nonapi.io.github.classgraph.utils.Assert, .LogNode

Holds metadata about a class encountered during a scan.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static enum
ClassInfo.ClassType

The class type to return.

pack-priv static class
ClassInfo.ReachableAndDirectlyRelatedClasses

A set of classes that indirectly reachable through a directed path, for a given relationship type, and a set of classes that is directly related (only one relationship step away).

pack-priv static enum
ClassInfo.RelType

How classes are related.

Field Summary

Modifier and TypeField and Description
private static final int
ANNOTATION_CLASS_MODIFIER

The modifier bit for annotations.

pack-priv AnnotationParameterValueList
annotationDefaultParamValues

For annotations, the default values of parameters.

pack-priv transient boolean
annotationDefaultParamValuesHasBeenConvertedToPrimitive

Set to true once any Object[] arrays of boxed types in annotationDefaultParamValues have been lazily converted to primitive arrays.

pack-priv AnnotationInfoList
annotationInfo

Info on class annotations, including optional annotation param values.

private AnnotationInfoList
annotationInfoRef

The annotation infos, once they are loaded

private ClassInfoList
annotationsRef

The annotations, once they are loaded

private int
classfileMajorVersion

The major version of the classfile format for this class' classfile.

private int
classfileMinorVersion

The minor version of the classfile format for this class' classfile.

protected transient Resource
classfileResource

The Resource for the classfile of this class.

pack-priv transient ClassLoader
classLoader

The classloader this class was obtained from.

pack-priv transient ClasspathElement
classpathElement

The classpath element that this class was found within.

pack-priv FieldInfoList
fieldInfo

Info on fields.

private String
fullyQualifiedDefiningMethodName

The fully-qualified defining method name, for anonymous inner classes.

protected boolean
isExternalClass

If true, this class is only being referenced by another class' classfile as a superclass / implemented interface / annotation, but this class is not itself an accepted (non-rejected) class, or in a accepted (non-rejected) package.

pack-priv boolean
isInherited

This annotation has the Inherited meta-annotation, which means that any class that this annotation is applied to also implicitly causes the annotation to annotate all subclasses too.

private boolean
isRecord

True if the class is a record.

protected boolean
isScannedClass

Set to true when the class is actually scanned (as opposed to just referenced as a superclass, interface or annotation of a scanned class).

pack-priv MethodInfoList
methodInfo

Info on fields.

private transient List<ClassInfo>
methodOverrideOrder

The override order for a class' methods (base class, followed by superclasses, followed by interfaces).

private int
modifiers

Class modifier flags, e.g. Modifier.PUBLIC

pack-priv ModuleInfo
moduleInfo

Info on the class module.

protected String
name

The name of the class.

private static final ClassInfo.ReachableAndDirectlyRelatedClasses
NO_REACHABLE_CLASSES

The constant empty return value used when no classes are reachable.

private transient List<ClassInfo>
overrideOrder

The override order for a class' fields or methods (base class, followed by interfaces, followed by superclasses).

pack-priv PackageInfo
packageInfo

Info on the package containing the class.

private ClassInfoList
referencedClasses

A list of ClassInfo objects for classes referenced by this class.

private Set<String>
referencedClassNames

Names of classes referenced by this class in class refs and type signatures in the constant pool of the classfile.

private Map<ClassInfo.RelType, Set<ClassInfo>>
relatedClasses

The set of classes related to this one.

private String
sourceFile

The name of the source file this class has been compiled from

pack-priv transient List<Classfile.ClassTypeAnnotationDecorator>
typeAnnotationDecorators

The type annotation decorators for the ClassTypeSignature instance.

private transient ClassTypeSignature
typeDescriptor

The synthetic class type descriptor.

private transient ClassTypeSignature
typeSignature

The class type signature, parsed.

protected String
typeSignatureStr

The class type signature string.

Inherited from io.github.classgraph.ScanResultObject:
classRefscanResult

Constructor Summary

AccessConstructor and Description
pack-priv
ClassInfo()

Default constructor for deserialization.

protected
ClassInfo(final String
the name
name
,
final int
the class modifiers
classModifiers
,
final Resource
the classfile resource
classfileResource
)

Constructor.

Method Summary

Modifier and TypeMethod and Description
pack-priv void
addAnnotationParamDefaultValues(final AnnotationParameterValueList
the default param names and values, if this is an annotation
paramNamesAndValues
)

Add annotation default values.

pack-priv void
addClassAnnotation(final AnnotationInfo
the class annotation info
classAnnotationInfo
,
final Map<String, ClassInfo>
the map from class name to class info
classNameToClassInfo
)

Add an annotation to this class.

pack-priv static void
addClassContainment(final List<Classfile.ClassContainment>
the class containment entries
classContainmentEntries
,
final Map<String, ClassInfo>
the map from class name to class info
classNameToClassInfo
)

Add class containment info.

pack-priv void
addFieldInfo(final FieldInfoList
the field info list
fieldInfoList
,
final Map<String, ClassInfo>
the map from class name to class info
classNameToClassInfo
)

Add field info.

private void
addFieldOrMethodAnnotationInfo(final AnnotationInfoList
the annotation info list
annotationInfoList
,
final boolean
the is field
isField
,
final int
the field or method modifiers
modifiers
,
final Map<String, ClassInfo>
the map from class name to class info
classNameToClassInfo
)

Add field or method annotation cross-links.

pack-priv void
addFullyQualifiedDefiningMethodName(final String
the fully qualified defining method name
fullyQualifiedDefiningMethodName
)

Add containing method name, for anonymous inner classes.

pack-priv void
addImplementedInterface(final String
the interface name
interfaceName
,
final Map<String, ClassInfo>
the map from class name to class info
classNameToClassInfo
)

Add an implemented interface to this class.

pack-priv void
addMethodInfo(final MethodInfoList
the method info list
methodInfoList
,
final Map<String, ClassInfo>
the map from class name to class info
classNameToClassInfo
)

Add method info.

pack-priv void
addReferencedClassNames(final Set<String>
the referenced class names
refdClassNames
)

Add names of classes referenced by this class.

pack-priv boolean

Returns:

true, if successful
addRelatedClass
(final ClassInfo.RelType relType, final ClassInfo classInfo)

Add a class with a given relationship type.

pack-priv static ClassInfo

Returns:

the class info
addScannedClass
(final String
the class name
className
,
final int
the class modifiers
classModifiers
,
final boolean
true if this is an external class
isExternalClass
,
final Map<String, ClassInfo>
the map from class name to class info
classNameToClassInfo
,
final ClasspathElement
the classpath element
classpathElement
,
final Resource
the classfile resource
classfileResource
)

Add a class that has just been scanned (as opposed to just referenced by a scanned class).

pack-priv void
addSuperclass(final String
the superclass name
superclassName
,
final Map<String, ClassInfo>
the map from class name to class info
classNameToClassInfo
)

Add a superclass to this class.

pack-priv void
public int

Returns:

the comparison result
compareTo
(final ClassInfo
the other object
o
)

Implements java.lang.Comparable.compareTo.

Compare based on class name.

public boolean

Returns:

Whether the objects were equal.
equals
(final Object
the other object
obj
)

Overrides java.lang.Object.equals.

Use class name for equals().

public boolean

Returns:

true if this class extends the superclass.
extendsSuperclass
(final Class<?>
A superclass.
superclass
)

Checks if this class extends the superclass.

public boolean

Returns:

true if this class extends the named superclass.
extendsSuperclass
(final String
The name of a superclass.
superclassName
)

Checks if this class extends the named superclass.

private static Set<ClassInfo>

Returns:

the filtered classes.
filterClassInfo
(final Collection<ClassInfo>
the classes
classes
,
final ScanSpec
the scan spec
scanSpec
,
final boolean
If true, exclude class if it is external, if external classes are not enabled
strictAccept
,
final ClassInfo.ClassType...
the class types
classTypes
)

Filter classes according to scan spec and class type.

private ClassInfo.ReachableAndDirectlyRelatedClasses

Returns:

the reachable and directly related classes
filterClassInfo
(final ClassInfo.RelType
the relationship type
relType
,
final boolean
If true, exclude class if it is external, if external classes are not enabled
strictAccept
,
final ClassInfo.ClassType...
the class types to accept
classTypes
)

Get the classes related to this one (the transitive closure) for the given relationship type, and those directly related.

protected void
findReferencedClassInfo(final Map<String, ClassInfo>
the map from class name to ClassInfo.
classNameToClassInfo
,
final Set<ClassInfo>
the referenced class info
refdClassInfo
,
final LogNode
the log
log
)

Overrides io.github.classgraph.ScanResultObject.findReferencedClassInfo.

Get ClassInfo objects for any classes referenced in this class' type descriptor, or the type descriptors of fields, methods or annotations.

pack-priv static ClassInfoList

Returns:

A list of all annotation classes found during the scan, or the empty list if none.
getAllAnnotationClasses
(final Collection<ClassInfo>
the classes
classes
,
final ScanSpec
the scan spec
scanSpec
)

Get all annotation classes found during the scan.

pack-priv static ClassInfoList

Returns:

A list of all classes found during the scan, or the empty list if none.
getAllClasses
(final Collection<ClassInfo>
the classes
classes
,
final ScanSpec
the scan spec
scanSpec
)

Get all classes found during the scan.

pack-priv static ClassInfoList

Returns:

A list of all Enum classes found during the scan, or the empty list if none.
getAllEnums
(final Collection<ClassInfo>
the classes
classes
,
final ScanSpec
the scan spec
scanSpec
)

Get all Enum classes found during the scan.

pack-priv static ClassInfoList

Returns:

A list of all annotation classes found during the scan, or the empty list if none.
getAllImplementedInterfaceClasses
(final Collection<ClassInfo>
the classes
classes
,
final ScanSpec
the scan spec
scanSpec
)

Get all implemented interface (non-annotation interface) classes found during the scan.

pack-priv static ClassInfoList

Returns:

A list of all accepted interfaces found during the scan, or the empty list if none.
getAllInterfacesOrAnnotationClasses
(final Collection<ClassInfo>
the classes
classes
,
final ScanSpec
the scan spec
scanSpec
)

Get all interface or annotation classes found during the scan.

pack-priv static ClassInfoList

Returns:

A list of all record classes found during the scan, or the empty list if none.
getAllRecords
(final Collection<ClassInfo>
the classes
classes
,
final ScanSpec
the scan spec
scanSpec
)

Get all record classes found during the scan.

pack-priv static ClassInfoList

Returns:

A list of all standard classes found during the scan, or the empty list if none.
getAllStandardClasses
(final Collection<ClassInfo>
the classes
classes
,
final ScanSpec
the scan spec
scanSpec
)

Get all standard classes found during the scan.

public AnnotationParameterValueList

Returns:

A list of AnnotationParameterValue objects for each of the default parameter values for this annotation, if this is an annotation class with default parameter values, otherwise the empty list.
getAnnotationDefaultParameterValues
()

Get the default parameter values for this annotation, if this is an annotation class.

public AnnotationInfoList

Returns:

A list of AnnotationInfo objects for the annotations on this class, or the empty list if none.
getAnnotationInfo
()

Get a list of the annotations on this class, or the empty list if none.

public AnnotationInfo

Returns:

An AnnotationInfo object representing the annotation on this class, or null if the class does not have the annotation.
getAnnotationInfo
(final Class<? extends Annotation>
The annotation.
annotation
)

Get a the non-Repeatable annotation on this class, or null if the class does not have the annotation.

public AnnotationInfo

Returns:

An AnnotationInfo object representing the named annotation on this class, or null if the class does not have the named annotation.
getAnnotationInfo
(final String
The annotation name.
annotationName
)

Get a the named non-Repeatable annotation on this class, or null if the class does not have the named annotation.

public AnnotationInfoList

Returns:

An AnnotationInfoList of all instances of the annotation on this class, or the empty list if the class does not have the annotation.
getAnnotationInfoRepeatable
(final Class<? extends Annotation>
The annotation.
annotation
)

Get a the Repeatable annotation on this class, or the empty list if the class does not have the annotation.

public AnnotationInfoList

Returns:

An AnnotationInfoList of all instances of the named annotation on this class, or the empty list if the class does not have the named annotation.
getAnnotationInfoRepeatable
(final String
The annotation name.
annotationName
)

Get a the named Repeatable annotation on this class, or the empty list if the class does not have the named annotation.

public ClassInfoList

Returns:

the list of annotations and meta-annotations on this class.
getAnnotations
()

Get the annotations and meta-annotations on this class.

public ClassInfoList

Returns:

A ClassInfoList of ClassInfo objects for all classes referenced by this class. Note that you need to call ClassGraph#enableInterClassDependencies() before ClassGraph#scan() for this method to work. You should also call ClassGraph#enableExternalClasses() before ClassGraph#scan() if you want non-accepted classes to appear in the result.
getClassDependencies
()

Get the class dependencies.

public ClassInfoList

Returns:

the list of the classes (and their subclasses) that implement this interface, if this is an interface, otherwise returns the empty list.
getClassesImplementing
()

Get the classes (and their subclasses) that implement this interface, if this is an interface.

public ClassInfoList

Returns:

A list of standard classes and non-annotation interfaces that are annotated by this class, if this is an annotation class, or the empty list if none. Also handles the Inherited meta-annotation, which causes an annotation on a class to be inherited by all of its subclasses.
getClassesWithAnnotation
()

Get the classes that have this class as an annotation.

pack-priv ClassInfoList

Returns:

The list of classes that are directly (i.e. are not meta-annotated) annotated with the requested annotation, or the empty list if none.
getClassesWithAnnotationDirectOnly
()

Get the classes that have this class as a direct annotation.

public ClassInfoList

Returns:

A list of classes that have a field with this annotation or meta-annotation, or the empty list if none.
getClassesWithFieldAnnotation
()

Get the classes that have this class as a field annotation or meta-annotation.

pack-priv ClassInfoList

Returns:

A list of classes that declare fields that are directly annotated (i.e. are not meta-annotated) with the requested method annotation, or the empty list if none.
getClassesWithFieldAnnotationDirectOnly
()

Get the classes that have this class as a direct field annotation.

private ClassInfoList

Returns:

A list of classes that have a declared method with this annotation or meta-annotation, or the empty list if none.
getClassesWithFieldOrMethodAnnotation
(final ClassInfo.RelType relType)

Get the classes that have this class as a field, method or method parameter annotation.

public ClassInfoList

Returns:

A list of classes that have a declared method with this annotation or meta-annotation, or the empty list if none.
getClassesWithMethodAnnotation
()

Get all classes that have this class as a method annotation, and their subclasses, if the method is non-private.

pack-priv ClassInfoList

Returns:

A list of classes that declare methods that are directly annotated (i.e. are not meta-annotated) with the requested method annotation, or the empty list if none.
getClassesWithMethodAnnotationDirectOnly
()

Get the classes that have this class as a direct method annotation.

public ClassInfoList

Returns:

A list of classes that have a declared method with a parameter that is annotated with this annotation or meta-annotation, or the empty list if none.
getClassesWithMethodParameterAnnotation
()

Get all classes that have this class as a method parameter annotation, and their subclasses, if the method is non-private.

pack-priv ClassInfoList

Returns:

A list of classes that declare methods with parameters that are directly annotated (i.e. are not meta-annotated) with the requested method annotation, or the empty list if none.
getClassesWithMethodParameterAnnotationDirectOnly
()

Get the classes that have this class as a direct method parameter annotation.

public int

Returns:

The major version of the classfile format for this class' classfile, or 0 if this ClassInfo object is a placeholder for a referenced class that was not found or not accepted during the scan.
getClassfileMajorVersion
()

Get the major version of the classfile format for this class' classfile.

public int

Returns:

The minor version of the classfile format for this class' classfile, or 0 if this ClassInfo object is a placeholder for a referenced class that was not found or not accepted during the scan.
getClassfileMinorVersion
()

Get the minor version of the classfile format for this class' classfile.

protected ClassInfo
getClassInfo()

Overrides io.github.classgraph.ScanResultObject.getClassInfo.

Get the ClassInfo object for the referenced class, or null if the referenced class was not encountered during scanning (i.e. no ClassInfo object was created for the class during scanning).

protected String
getClassName()

Implements abstract io.github.classgraph.ScanResultObject.getClassName.

The name of the class (used by getClassInfo() to fetch the ClassInfo object for the class).

public File

Returns:

The File for the classpath element package root dir or jar that this class was found within, or null if this class was found in a module (see getModuleRef). May also return null if the classpath element was an http/https URL, and the jar was downloaded directly to RAM, rather than to a temp file on disk (e.g. if the temp dir is not writeable).
getClasspathElementFile
()

Get the File for the classpath element package root dir or jar that this class was found within, or null if this class was found in a module.

public URI

Returns:

The URI of the classpath element that this class was found within.
getClasspathElementURI
()

Get the URI of the classpath element that this class was found within.

public URL

Returns:

The URL of the classpath element that this class was found within.
getClasspathElementURL
()

Get the URL of the classpath element or module that this class was found within.

public MethodInfoList

Returns:

the list of MethodInfo objects for visible constructors of this class and its superclasses, or the empty list if no methods were found.
getConstructorInfo
()

Returns information on visible constructors declared by this class, or by its interfaces or superclasses.

public MethodInfoList

Returns:

the list of MethodInfo objects for visible constructors declared by this class, or the empty list if no constructors were found or visible.
getDeclaredConstructorInfo
()

Returns information on visible constructors declared by this class, but not by its interfaces or superclasses.

public FieldInfoList

Returns:

the list of FieldInfo objects for visible fields declared by this class, or the empty list if no fields were found or visible.
getDeclaredFieldInfo
()

Returns information on all visible fields declared by this class, but not by its superclasses.

public FieldInfo

Returns:

the FieldInfo object for the named field declared by this class, or null if the field was not found in this class (or is not visible).
getDeclaredFieldInfo
(final String
The field name.
fieldName
)

Returns information on the named field declared by the class, but not by its superclasses.

public MethodInfoList

Returns:

the list of MethodInfo objects for visible methods and constructors of this class, or the empty list if no methods or constructors were found or visible.
getDeclaredMethodAndConstructorInfo
()

Returns information on visible methods and constructors declared by this class, but not by its interfaces or superclasses.

private MethodInfoList

Returns:

the declared method info
getDeclaredMethodInfo
(final String
the method name
methodName
,
final boolean
whether to get normal methods
getNormalMethods
,
final boolean
whether to get constructor methods
getConstructorMethods
,
final boolean
whether to get static initializer methods
getStaticInitializerMethods
)

Get the declared methods, constructors, and/or static initializer methods of the class.

public MethodInfoList

Returns:

the list of MethodInfo objects for visible methods declared by this class, or the empty list if no methods were found.
getDeclaredMethodInfo
()

Returns information on visible methods declared by this class, but not by its interfaces or superclasses, that are not constructors.

public MethodInfoList

Returns:

a list of MethodInfo objects for the method(s) with the given name, or the empty list if the method was not found in this class (or is not visible).
getDeclaredMethodInfo
(final String
The method name to query.
methodName
)

Returns information on the method(s) or constructor(s) of the given name declared by this class, but not by its interfaces or superclasses.

public List<Object>

Returns:

All enum constants of an enum class as a list of objects of the same type as the enum.
getEnumConstantObjects
()

public FieldInfoList

Returns:

All enum constants of an enum class as a list of FieldInfo objects (enum constants are stored as fields in Java classes).
getEnumConstants
()

public ClassInfoList

Returns:

A list of all annotations on fields of this class, or the empty list if none. N.B. these annotations do not contain specific annotation parameters -- call FieldInfo#getAnnotationInfo() to get details on specific field annotation instances.
getFieldAnnotations
()

Get all field annotations.

public FieldInfoList

Returns:

the list of FieldInfo objects for visible fields of this class or its superclases, or the empty list if no fields were found or visible.
getFieldInfo
()

Returns information on all visible fields declared by this class, or by its superclasses.

public FieldInfo

Returns:

the FieldInfo object for the named field of this class or its superclases, or the empty list if no fields were found or visible.
getFieldInfo
(final String
The field name.
fieldName
)

Returns information on the named filed declared by this class, or by its superclasses.

private ClassInfoList

Returns:

A list of annotations or meta-annotations on fields or methods declared by the class, (not including fields or methods declared by the interfaces or superclasses of this class), as a list of ClassInfo objects, or the empty list if none.
getFieldOrMethodAnnotations
(final ClassInfo.RelType relType)

Get the annotations or meta-annotations on fields, methods or method parametres declared by the class, (not including fields, methods or method parameters declared by the interfaces or superclasses of this class).

private List<ClassInfo>

Returns:

the override order
getFieldOverrideOrder
(final Set<ClassInfo>
visited
visited
,
final List<ClassInfo>
the override order
overrideOrderOut
)

Recurse to interfaces and superclasses to get the order that fields are overridden in.

private List<ClassInfo>

Returns:

the override order
getFieldOverrideOrder
()

Get the order that fields are overridden in (base class first).

public String

Returns:

The fully-qualified method name (i.e. fully qualified classname, followed by dot, followed by method name) for the defining method, if this is an anonymous inner class, or null if not.
getFullyQualifiedDefiningMethodName
()

Gets fully-qualified method name (i.e. fully qualified classname, followed by dot, followed by method name) for the defining method, if this is an anonymous inner class.

public ClassInfoList

Returns:

A list of the inner classes contained within this class, or the empty list if none.
getInnerClasses
()

Get the inner classes contained within this class, if this is an outer class.

public ClassInfoList

Returns:

The list of interfaces implemented by this class or by one of its superclasses, if this is a standard class, or the superinterfaces extended by this interface, if this is an interface. Returns the empty list if none.
getInterfaces
()

Get the interfaces implemented by this class or by one of its superclasses, if this is a standard class, or the superinterfaces extended by this interface, if this is an interface.

public MethodInfoList

Returns:

the list of MethodInfo objects for visible methods and constructors of this class, its interfaces and superclasses, or the empty list if no methods were found.
getMethodAndConstructorInfo
()

Returns information on visible constructors declared by this class, or by its interfaces or superclasses.

public ClassInfoList

Returns:

A list of all annotations or meta-annotations on methods declared by the class, (not including methods declared by the interfaces or superclasses of this class), as a list of ClassInfo objects, or the empty list if none. N.B. these annotations do not contain specific annotation parameters -- call MethodInfo#getAnnotationInfo() to get details on specific method annotation instances.
getMethodAnnotations
()

Get all method annotations.

private MethodInfoList

Returns:

the method info
getMethodInfo
(final String
the method name
methodName
,
final boolean
whether to get normal methods
getNormalMethods
,
final boolean
whether to get constructor methods
getConstructorMethods
,
final boolean
whether to get static initializer methods
getStaticInitializerMethods
)

Get the methods, constructors, and/or static initializer methods of the class.

public MethodInfoList

Returns:

the list of MethodInfo objects for visible methods of this class, its interfaces and superclasses, or the empty list if no methods were found.
getMethodInfo
()

Returns information on visible methods declared by this class, or by its interfaces or superclasses, that are not constructors.

public MethodInfoList

Returns:

a list of MethodInfo objects for the method(s) with the given name, or the empty list if the method was not found in this class (or is not visible).
getMethodInfo
(final String
The method name to query.
methodName
)

Returns information on the method(s) or constructor(s) of the given name declared by this class, but not by its interfaces or superclasses.

private List<ClassInfo>

Returns:

the overrideOrderOut instance
getMethodOverrideOrder
(final Set<ClassInfo>
non-null set of already visited ClassInfos
visited
,
final List<ClassInfo>
non-null outgoing list of ClassInfos in descending override order.
overrideOrderOut
)

Recurse to collect classes and interfaces in the order of overridden methods, in descending priority.

private List<ClassInfo>

Returns:

the override order
getMethodOverrideOrder
()

Get the order that methods are overridden in.

public ClassInfoList

Returns:

A list of all annotations or meta-annotations on methods declared by the class, (not including methods declared by the interfaces or superclasses of this class), as a list of ClassInfo objects, or the empty list if none. N.B. these annotations do not contain specific annotation parameters -- call MethodInfo#getAnnotationInfo() to get details on specific method annotation instances.
getMethodParameterAnnotations
()

Get all method parameter annotations.

public int

Returns:

The class modifier bits, e.g. Modifier#PUBLIC.
getModifiers
()

Get the class modifier bits.

public String

Returns:

The field modifiers as a string, e.g. "public static final". For the modifier bits, call getModifiers().
getModifiersStr
()

Get the class modifiers as a String.

public ModuleInfo

Returns:

the ModuleInfo object for the class, or null if the class is not part of a named module.
getModuleInfo
()

Get the ModuleInfo object for the class.

public ModuleRef

Returns:

The module that this class was found within, as a ModuleRef, or null if this class was found in a directory or jar in the classpath. (See also getClasspathElementFile().)
getModuleRef
()

Get the module that this class was found within, as a ModuleRef, or null if this class was found in a directory or jar in the classpath.

public String

Returns:

The name of the class.
getName
()

Implements io.github.classgraph.HasName.getName.

Get the name of the class.

pack-priv static ClassInfo

Returns:

the ClassInfo object.
getOrCreateClassInfo
(final String
the class name
className
,
final Map<String, ClassInfo>
the map from class name to class info
classNameToClassInfo
)

Get a ClassInfo object, or create it if it doesn't exist.

public ClassInfoList

Returns:

A list of the containing outer classes, if this is an inner class, otherwise the empty list. Note that all containing outer classes are returned, not just the innermost of the containing outer classes.
getOuterClasses
()

Get the containing outer classes, if this is an inner class.

public PackageInfo

Returns:

the PackageInfo object for the package that contains the class.
getPackageInfo
()

Get the PackageInfo object for the class.

public String

Returns:

The name of the class' package.
getPackageName
()

Get the name of the class' package.

public Resource

Returns:

The Resource for the classfile of this class. Returns null if the classfile for this class was not actually read during the scan, e.g. because this class was not itself accepted, but was referenced by an accepted class.
getResource
()

The Resource for the classfile of this class.

pack-priv static String

Returns:

The simple name of the class.
getSimpleName
(final String
the class name
className
)

Get simple name from fully-qualified class name.

public String

Returns:

The simple name of the class.
getSimpleName
()

Get the simple name of the class.

public String

Returns:

The name of the source file of this class, or null if not available
getSourceFile
()

Returns the name of the source file this class has been compiled from, such as ClassInfo.java or KClass.kt.

public ClassInfoList

Returns:

the list of subclasses of this class, or the empty list if none.
getSubclasses
()

Get the subclasses of this class, sorted in order of name.

public ClassInfo

Returns:

the superclass of this class, or null if none.
getSuperclass
()

Get the single direct superclass of this class, or null if none.

public ClassInfoList

Returns:

the list of all superclasses of this class, or the empty list if none.
getSuperclasses
()

Get all superclasses of this class, in ascending order in the class hierarchy, not including Object for simplicity, since that is the superclass of all classes.

public ClassTypeSignature

Returns:

The synthetic type descriptor for the class.
getTypeDescriptor
()

Returns a synthetic type descriptor for the method, created from the class name, superclass name, and implemented interfaces.

public ClassTypeSignature

Returns:

The parsed type signature for the class, including any generic type parameters, or null if not available (probably indicating the class is not generic).
getTypeSignature
()

Get the parsed type signature for the class.

public ClassTypeSignature

Returns:

The parsed generic type signature for the class, or if not available, the synthetic type descriptor for the class.
getTypeSignatureOrTypeDescriptor
()

Returns the parsed type signature for this class, possibly including type parameters.

public String

Returns:

The type signature string for the class, including any generic type parameters, or null if not available (probably indicating the class is not generic).
getTypeSignatureStr
()

Get the type signature string for the class.

pack-priv void
handleRepeatableAnnotations(final Set<String>
the names of all repeatable annotations
allRepeatableAnnotationNames
)

Handle Repeatable annotations.

public boolean

Returns:

true if this class has the annotation.
hasAnnotation
(final Class<? extends Annotation>
An annotation.
annotation
)

Checks whether this class has the annotation.

public boolean

Returns:

true if this class has the named annotation.
hasAnnotation
(final String
The name of an annotation.
annotationName
)

Checks whether this class has the named annotation.

public boolean

Returns:

true if this class declares a field of the given name.
hasDeclaredField
(final String
The name of a field.
fieldName
)

Checks whether this class has the named declared field.

public boolean

Returns:

true if this class declares a field with the annotation.
hasDeclaredFieldAnnotation
(final Class<? extends Annotation>
A field annotation.
annotation
)

Checks whether this class declares a field with the annotation.

public boolean

Returns:

true if this class declares a field with the named annotation.
hasDeclaredFieldAnnotation
(final String
The name of a field annotation.
fieldAnnotationName
)

Checks whether this class declares a field with the named annotation.

public boolean

Returns:

true if this class declares a method of the given name.
hasDeclaredMethod
(final String
The name of a method.
methodName
)

Checks whether this class declares a method of the given name.

public boolean

Returns:

true if this class declares a method with the annotation.
hasDeclaredMethodAnnotation
(final Class<? extends Annotation>
A method annotation.
methodAnnotation
)

Checks whether this class declares a method with the annotation.

public boolean

Returns:

true if this class declares a method with the named annotation.
hasDeclaredMethodAnnotation
(final String
The name of a method annotation.
methodAnnotationName
)

Checks whether this class declares a method with the named annotation.

public boolean

Returns:

true if this class declares a method with the annotation.
hasDeclaredMethodParameterAnnotation
(final Class<? extends Annotation>
A method annotation.
methodParameterAnnotation
)

Checks whether this class declares a method with the annotation.

public boolean

Returns:

true if this class declares a method with the named annotation.
hasDeclaredMethodParameterAnnotation
(final String
The name of a method annotation.
methodParameterAnnotationName
)

Checks whether this class declares a method with the named annotation.

public boolean

Returns:

true if this class or one of its superclasses declares a field of the given name.
hasField
(final String
The name of a field.
fieldName
)

Checks whether this class or one of its superclasses has the named field.

public boolean

Returns:

true if this class or one of its superclasses declares a field with the annotation.
hasFieldAnnotation
(final Class<? extends Annotation>
A field annotation.
fieldAnnotation
)

Checks whether this class or one of its superclasses declares a field with the annotation.

public boolean

Returns:

true if this class or one of its superclasses declares a field with the named annotation.
hasFieldAnnotation
(final String
The name of a field annotation.
fieldAnnotationName
)

Checks whether this class or one of its superclasses declares a field with the named annotation.

public int

Returns:

the hashcode
hashCode
()

Overrides java.lang.Object.hashCode.

Use hash code of class name.

public boolean

Returns:

true if this class or one of its superclasses or interfaces declares a method of the given name.
hasMethod
(final String
The name of a method.
methodName
)

Checks whether this class or one of its superclasses or interfaces declares a method of the given name.

public boolean

Returns:

true if this class or one of its superclasses or interfaces declares a method with the annotation.
hasMethodAnnotation
(final Class<? extends Annotation>
A method annotation.
methodAnnotation
)

Checks whether this class or one of its superclasses or interfaces declares a method with the annotation.

public boolean

Returns:

true if this class or one of its superclasses or interfaces declares a method with the named annotation.
hasMethodAnnotation
(final String
The name of a method annotation.
methodAnnotationName
)

Checks whether this class or one of its superclasses or interfaces declares a method with the named annotation.

public boolean

Returns:

true if this class or one of its superclasses or interfaces has a method with the annotation.
hasMethodParameterAnnotation
(final Class<? extends Annotation>
A method annotation.
methodParameterAnnotation
)

Checks whether this class or one of its superclasses or interfaces has a method with the annotation.

public boolean

Returns:

true if this class or one of its superclasses or interfaces has a method with the named annotation.
hasMethodParameterAnnotation
(final String
The name of a method annotation.
methodParameterAnnotationName
)

Checks whether this class or one of its superclasses or interfaces has a method with the named annotation.

public boolean

Returns:

true if this class implements the interface.
implementsInterface
(final Class<?>
An interface.
interfaceClazz
)

Checks whether this class implements the interface.

public boolean

Returns:

true if this class implements the named interface.
implementsInterface
(final String
The name of an interface.
interfaceName
)

Checks whether this class implements the named interface.

public boolean

Returns:

true if this class is an abstract class.
isAbstract
()

Checks if the class is abstract.

public boolean

Returns:

true if this class is an annotation class.
isAnnotation
()

Checks if the class is an annotation.

public boolean

Returns:

true if this is an anonymous inner class. If true, the name of the containing method can be obtained by calling getFullyQualifiedDefiningMethodName().
isAnonymousInnerClass
()

Checks if this class is an anonymous inner class.

public boolean

Returns:

true if this is an array class.
isArrayClass
()

Checks if this class is an array class.

public boolean

Returns:

true if this class is an Enum.
isEnum
()

Checks if is the class is an Enum.

public boolean

Returns:

true if this class is an external class, i.e. was referenced by an accepted class as a superclass, interface, or annotation, but is not itself an accepted class.
isExternalClass
()

Checks if this is an external class.

public boolean

Returns:

true if this class is a final class.
isFinal
()

Checks if the class is final.

public boolean

Returns:

true if this class is an implemented interface.
isImplementedInterface
()

Checks whether this class is an implemented interface (meaning a standard, non-annotation interface, or an annotation that has also been implemented as an interface by some class).

public boolean

Returns:

true if this is an inner class (call isAnonymousInnerClass() to test if this is an anonymous inner class). If true, the containing class can be determined by calling getOuterClasses().
isInnerClass
()

Checks if this class is an inner class.

public boolean

Returns:

true if this class is an interface and is not an annotation (annotations are interfaces, and can be implemented).
isInterface
()

Checks if is the class an interface and is not an annotation.

public boolean

Returns:

true if this class is an interface or an annotation (annotations are interfaces, and can be implemented).
isInterfaceOrAnnotation
()

Checks if is an interface or an annotation.

public boolean

Returns:

true if this class contains inner classes. If true, the inner classes can be determined by calling getInnerClasses().
isOuterClass
()

Checks if this class is an outer class.

public boolean

Returns:

true if this class is only visible within its package.
isPackageVisible
()

Checks if the class has default (package) visibility.

public boolean

Returns:

true if this class is a private class.
isPrivate
()

Checks if the class is private.

public boolean

Returns:

true if this class is a protected class.
isProtected
()

Checks if the class is protected.

public boolean

Returns:

true if this class is a public class.
isPublic
()

Checks if the class is public.

public boolean

Returns:

true if this class is a record.
isRecord
()

Checks if is the class is a record (JDK 14+).

public boolean

Returns:

true if this class is a standard class (i.e. is not an annotation or interface).
isStandardClass
()

Checks if this class is a standard class.

public boolean

Returns:

true if this class is static.
isStatic
()

Checks if the class is static.

public boolean

Returns:

true if this class is a synthetic class.
isSynthetic
()

Checks if the class is synthetic.

public <
the superclass or interface type
T
>
Class<T>

Returns:

The class reference, or null, if ignoreExceptions is true and there was an exception or error loading the class.
loadClass
(final Class<T>
The Class reference for the type to cast the loaded class to.
superclassOrInterfaceType
,
final boolean
If true, return null if any exceptions or errors thrown during classloading, or if attempting to cast the resulting Class<?> reference to the requested superclass or interface type fails. If false, IllegalArgumentException is thrown if the class could not be loaded or could not be cast to the requested type.
ignoreExceptions
)

Overrides io.github.classgraph.ScanResultObject.loadClass.

Obtain a Class<?

public <
The superclass or interface type
T
>
Class<T>

Returns:

The class reference.
loadClass
(final Class<T>
The type to cast the loaded class to.
superclassOrInterfaceType
)

Overrides io.github.classgraph.ScanResultObject.loadClass.

Obtain a Class<?

public Class<?>

Returns:

The class reference, or null, if ignoreExceptions is true and there was an exception or error loading the class.
loadClass
(final boolean
Whether or not to ignore exceptions
ignoreExceptions
)

Overrides io.github.classgraph.ScanResultObject.loadClass.

Obtain a Class<?

public Class<?>

Returns:

The class reference.
loadClass
()

Overrides io.github.classgraph.ScanResultObject.loadClass.

Obtain a Class<?

pack-priv void
setClassfileVersion(final int
the minor version of the classfile format for this class' classfile.
minorVersion
,
final int
the major version of the classfile format for this class' classfile.
majorVersion
)

Set classfile version.

pack-priv void
setIsAnnotation(final boolean
true if this is an annotation
isAnnotation
)

Set isAnnotation status.

pack-priv void
setIsInterface(final boolean
true if this is an interface
isInterface
)

Set isInterface status.

pack-priv void
setIsRecord(final boolean
true if this is a record
isRecord
)

Set isRecord status.

pack-priv void
setModifiers(final int
the class modifiers
modifiers
)

Set class modifiers.

pack-priv void
setReferencedClasses(final ClassInfoList
the referenced classes
refdClasses
)

Set the list of ClassInfo objects for classes referenced by this class.

pack-priv void
setScanResult(final ScanResult
the scan result
scanResult
)

Overrides io.github.classgraph.ScanResultObject.setScanResult.

Set ScanResult backreferences in info objects after scan has completed.

pack-priv void
setSourceFile(final String
the source file
sourceFile
)

Set source file.

pack-priv void
setTypeSignature(final String
the type signature str
typeSignatureStr
)

Set the class type signature, including any type params.

protected void
toString(final boolean
use simple names
useSimpleNames
,
final StringBuilder
the buf
buf
)

Implements abstract io.github.classgraph.ScanResultObject.toString.

To string.

Inherited from io.github.classgraph.ScanResultObject:
findReferencedClassInfotoStringtoStringtoStringWithSimpleNames