Package io.github.classgraph
Class AnnotationClassRef
- java.lang.Object
-
- io.github.classgraph.ScanResultObject
-
- io.github.classgraph.AnnotationClassRef
-
public class AnnotationClassRef extends ScanResultObject
Stores the type descriptor of aClass<?>
, as found in an annotation parameter value.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
className
The class name.private java.lang.String
typeDescriptorStr
The type descriptor str.private TypeSignature
typeSignature
The type signature.-
Fields inherited from class io.github.classgraph.ScanResultObject
classRef, scanResult
-
-
Constructor Summary
Constructors Constructor Description AnnotationClassRef()
Constructor.AnnotationClassRef(java.lang.String typeDescriptorStr)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
ClassInfo
getClassInfo()
Get the class info.protected java.lang.String
getClassName()
The name of the class (used byScanResultObject.getClassInfo()
to fetch theClassInfo
object for the class).java.lang.String
getName()
Get the name of the referenced class.private TypeSignature
getTypeSignature()
Get the type signature.int
hashCode()
java.lang.Class<?>
loadClass()
Loads the referenced class, returning aClass<?>
reference for the referenced class.java.lang.Class<?>
loadClass(boolean ignoreExceptions)
Loads the referenced class, returning aClass<?>
reference for the referenced class.(package private) void
setScanResult(ScanResult scanResult)
Set ScanResult backreferences in info objects after scan has completed.protected void
toString(boolean useSimpleNames, java.lang.StringBuilder buf)
Render to string.-
Methods inherited from class io.github.classgraph.ScanResultObject
findReferencedClassInfo, findReferencedClassInfo, loadClass, loadClass, toString, toString, toStringWithSimpleNames
-
-
-
-
Field Detail
-
typeDescriptorStr
private java.lang.String typeDescriptorStr
The type descriptor str.
-
typeSignature
private transient TypeSignature typeSignature
The type signature.
-
className
private transient java.lang.String className
The class name.
-
-
Method Detail
-
getName
public java.lang.String getName()
Get the name of the referenced class.- Returns:
- The name of the referenced class.
-
getTypeSignature
private TypeSignature getTypeSignature()
Get the type signature.- Returns:
- The type signature of the
Class<?>
reference. This will be aClassRefTypeSignature
, aBaseTypeSignature
, or anArrayTypeSignature
.
-
loadClass
public java.lang.Class<?> loadClass(boolean ignoreExceptions)
Loads the referenced class, returning aClass<?>
reference for the referenced class.- Overrides:
loadClass
in classScanResultObject
- Parameters:
ignoreExceptions
- if true, ignore exceptions and instead return null if the class could not be loaded.- Returns:
- The
Class<?>
reference for the referenced class. - Throws:
java.lang.IllegalArgumentException
- if the class could not be loaded and ignoreExceptions was false.
-
loadClass
public java.lang.Class<?> loadClass()
Loads the referenced class, returning aClass<?>
reference for the referenced class.- Overrides:
loadClass
in classScanResultObject
- Returns:
- The
Class<?>
reference for the referenced class. - Throws:
java.lang.IllegalArgumentException
- if the class could not be loaded.
-
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
public ClassInfo getClassInfo()
Get the class info.- Overrides:
getClassInfo
in classScanResultObject
- Returns:
- The
ClassInfo
object for the referenced class, or null if the referenced class was not encountered during scanning (i.e. if no ClassInfo object was created for the class during scanning). N.B. even if this method returns null,loadClass()
may be able to load the referenced class by name.
-
setScanResult
void setScanResult(ScanResult scanResult)
Description copied from class:ScanResultObject
Set ScanResult backreferences in info objects after scan has completed.- Overrides:
setScanResult
in classScanResultObject
- Parameters:
scanResult
- the scan result
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
toString
protected void toString(boolean useSimpleNames, java.lang.StringBuilder buf)
Description copied from class:ScanResultObject
Render to string.- Specified by:
toString
in classScanResultObject
- Parameters:
useSimpleNames
- if true, use just the simple name of each class.buf
- the buf
-
-