Package io.github.classgraph
Class ClassTypeSignature
- java.lang.Object
-
- io.github.classgraph.ScanResultObject
-
- io.github.classgraph.HierarchicalTypeSignature
-
- io.github.classgraph.ClassTypeSignature
-
public final class ClassTypeSignature extends HierarchicalTypeSignature
A class type signature (called "ClassSignature" in the classfile documentation).
-
-
Field Summary
Fields Modifier and Type Field Description private ClassInfo
classInfo
The class info.private ClassRefTypeSignature
superclassSignature
The superclass type.private java.util.List<ClassRefTypeSignature>
superinterfaceSignatures
The superinterface signatures.private java.util.List<ClassRefOrTypeVariableSignature>
throwsSignatures
The throws signatures (usually null).(package private) java.util.List<TypeParameter>
typeParameters
The class type parameters.-
Fields inherited from class io.github.classgraph.HierarchicalTypeSignature
typeAnnotationInfo
-
Fields inherited from class io.github.classgraph.ScanResultObject
classRef, scanResult
-
-
Constructor Summary
Constructors Modifier Constructor Description (package private)
ClassTypeSignature(ClassInfo classInfo, ClassInfo superclass, ClassInfoList interfaces)
Constructor used to create synthetic class type descriptor (#662).private
ClassTypeSignature(ClassInfo classInfo, java.util.List<TypeParameter> typeParameters, ClassRefTypeSignature superclassSignature, java.util.List<ClassRefTypeSignature> superinterfaceSignatures, java.util.List<ClassRefOrTypeVariableSignature> throwsSignatures)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addTypeAnnotation(java.util.List<Classfile.TypePathNode> typePath, AnnotationInfo annotationInfo)
Add a type annotation.boolean
equals(java.lang.Object obj)
protected void
findReferencedClassInfo(java.util.Map<java.lang.String,ClassInfo> classNameToClassInfo, java.util.Set<ClassInfo> refdClassInfo, LogNode log)
GetClassInfo
objects for any classes referenced in the type descriptor or type signature.protected void
findReferencedClassNames(java.util.Set<java.lang.String> refdClassNames)
Get the names of any classes referenced in the type signature.protected ClassInfo
getClassInfo()
Get theClassInfo
object for the referenced class, or null if the referenced class was not encountered during scanning (i.e.protected java.lang.String
getClassName()
The name of the class (used byScanResultObject.getClassInfo()
to fetch theClassInfo
object for the class).ClassRefTypeSignature
getSuperclassSignature()
Get the type signature for the superclass (possibly null in the case ofObject
, since it doesn't have a superclass).java.util.List<ClassRefTypeSignature>
getSuperinterfaceSignatures()
Get the type signatures of any superinterfaces.(package private) java.util.List<ClassRefOrTypeVariableSignature>
getThrowsSignatures()
Gets the throws signatures.java.util.List<TypeParameter>
getTypeParameters()
Get the type parameters for the class.int
hashCode()
(package private) static ClassTypeSignature
parse(java.lang.String typeDescriptor, ClassInfo classInfo)
Parse a class type signature or class type descriptor.(package private) void
setScanResult(ScanResult scanResult)
Set ScanResult backreferences in info objects after scan has completed.protected void
toStringInternal(boolean useSimpleNames, AnnotationInfoList annotationsToExclude, java.lang.StringBuilder buf)
To string internal.(package private) void
toStringInternal(java.lang.String className, boolean useSimpleNames, int modifiers, boolean isAnnotation, boolean isInterface, AnnotationInfoList annotationsToExclude, java.lang.StringBuilder buf)
Render into String form.-
Methods inherited from class io.github.classgraph.HierarchicalTypeSignature
addTypeAnnotation, getTypeAnnotationInfo, toString
-
Methods inherited from class io.github.classgraph.ScanResultObject
findReferencedClassInfo, loadClass, loadClass, loadClass, loadClass, toString, toString, toStringWithSimpleNames
-
-
-
-
Field Detail
-
classInfo
private final ClassInfo classInfo
The class info.
-
typeParameters
final java.util.List<TypeParameter> typeParameters
The class type parameters.
-
superclassSignature
private final ClassRefTypeSignature superclassSignature
The superclass type.
-
superinterfaceSignatures
private final java.util.List<ClassRefTypeSignature> superinterfaceSignatures
The superinterface signatures.
-
throwsSignatures
private final java.util.List<ClassRefOrTypeVariableSignature> throwsSignatures
The throws signatures (usually null). These are only present in Scala classes, if the class is marked up with@throws
, and they violate the classfile spec (#495), but we parse them anyway.
-
-
Constructor Detail
-
ClassTypeSignature
private ClassTypeSignature(ClassInfo classInfo, java.util.List<TypeParameter> typeParameters, ClassRefTypeSignature superclassSignature, java.util.List<ClassRefTypeSignature> superinterfaceSignatures, java.util.List<ClassRefOrTypeVariableSignature> throwsSignatures)
Constructor.- Parameters:
classInfo
- theClassInfo
object of the class.typeParameters
- The class type parameters.superclassSignature
- The superclass signature.superinterfaceSignatures
- The superinterface signature(s).throwsSignatures
- the throws signatures (these are actually invalid, but can be added by Scala: #495). Usually null.
-
ClassTypeSignature
ClassTypeSignature(ClassInfo classInfo, ClassInfo superclass, ClassInfoList interfaces)
Constructor used to create synthetic class type descriptor (#662).- Parameters:
classInfo
- The class.superclass
- The superclass.interfaces
- The implemented interfaces.
-
-
Method Detail
-
getTypeParameters
public java.util.List<TypeParameter> getTypeParameters()
Get the type parameters for the class.- Returns:
- The type parameters for the class.
-
getSuperclassSignature
public ClassRefTypeSignature getSuperclassSignature()
Get the type signature for the superclass (possibly null in the case ofObject
, since it doesn't have a superclass).- Returns:
- The type signature for the superclass, or null if no superclass (i.e. for
Object
).
-
getSuperinterfaceSignatures
public java.util.List<ClassRefTypeSignature> getSuperinterfaceSignatures()
Get the type signatures of any superinterfaces.- Returns:
- The type signatures of any superinterfaces.
-
getThrowsSignatures
java.util.List<ClassRefOrTypeVariableSignature> getThrowsSignatures()
Gets the throws signatures. These are invalid according to the classfile spec (so this method is currently non-public), but may be added by the Scala compiler. (See bug #495.)- Returns:
- the throws signatures
-
addTypeAnnotation
protected void addTypeAnnotation(java.util.List<Classfile.TypePathNode> typePath, AnnotationInfo annotationInfo)
Description copied from class:HierarchicalTypeSignature
Add a type annotation.- Specified by:
addTypeAnnotation
in classHierarchicalTypeSignature
- Parameters:
typePath
- the type pathannotationInfo
- the annotation
-
getClassName
protected java.lang.String getClassName()
Description copied from class:ScanResultObject
The name of the class (used byScanResultObject.getClassInfo()
to fetch theClassInfo
object for the class).- Specified by:
getClassName
in classScanResultObject
- Returns:
- The class name.
-
getClassInfo
protected ClassInfo getClassInfo()
Description copied from class:ScanResultObject
Get theClassInfo
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). N.B. even if this method returns null,ScanResultObject.loadClass()
may be able to load the referenced class by name.- Overrides:
getClassInfo
in classScanResultObject
- Returns:
- The
ClassInfo
object for the referenced class.
-
setScanResult
void setScanResult(ScanResult scanResult)
Description copied from class:ScanResultObject
Set ScanResult backreferences in info objects after scan has completed.- Overrides:
setScanResult
in classHierarchicalTypeSignature
- Parameters:
scanResult
- the scan result
-
findReferencedClassNames
protected void findReferencedClassNames(java.util.Set<java.lang.String> refdClassNames)
Get the names of any classes referenced in the type signature.- Parameters:
refdClassNames
- the referenced class names.
-
findReferencedClassInfo
protected void findReferencedClassInfo(java.util.Map<java.lang.String,ClassInfo> classNameToClassInfo, java.util.Set<ClassInfo> refdClassInfo, LogNode log)
GetClassInfo
objects for any classes referenced in the type descriptor or type signature.- Overrides:
findReferencedClassInfo
in classScanResultObject
- Parameters:
classNameToClassInfo
- the map from class name toClassInfo
.refdClassInfo
- the referenced class infolog
- the log
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
toStringInternal
void toStringInternal(java.lang.String className, boolean useSimpleNames, int modifiers, boolean isAnnotation, boolean isInterface, AnnotationInfoList annotationsToExclude, java.lang.StringBuilder buf)
Render into String form.- Parameters:
className
- The class nameuseSimpleNames
- the use simple namesmodifiers
- The class modifiers.isAnnotation
- True if the class is an annotation.isInterface
- True if the class is an interface.annotationsToExclude
- the annotations to excludebuf
- the buf
-
toStringInternal
protected void toStringInternal(boolean useSimpleNames, AnnotationInfoList annotationsToExclude, java.lang.StringBuilder buf)
To string internal.- Specified by:
toStringInternal
in classHierarchicalTypeSignature
- Parameters:
useSimpleNames
- the use simple namesannotationsToExclude
- the annotations to excludebuf
- the buf
-
parse
static ClassTypeSignature parse(java.lang.String typeDescriptor, ClassInfo classInfo) throws ParseException
Parse a class type signature or class type descriptor.- Parameters:
typeDescriptor
- The class type signature or class type descriptor to parse.classInfo
- the class info- Returns:
- The parsed class type signature or class type descriptor.
- Throws:
ParseException
- If the class type signature could not be parsed.
-
-