Class AnnotationClassRef

java.lang.Object
io.github.classgraph.ScanResultObject
io.github.classgraph.AnnotationClassRef

public class AnnotationClassRef extends ScanResultObject
Stores the type descriptor of a Class<?>, as found in an annotation parameter value.
  • Field Details

    • typeDescriptorStr

      private String typeDescriptorStr
      The type descriptor str.
    • typeSignature

      private transient TypeSignature typeSignature
      The type signature.
    • className

      private transient String className
      The class name.
  • Constructor Details

    • AnnotationClassRef

      AnnotationClassRef()
      Constructor.
    • AnnotationClassRef

      AnnotationClassRef(String typeDescriptorStr)
      Constructor.
      Parameters:
      typeDescriptorStr - the type descriptor str
  • Method Details

    • getName

      public 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 a ClassRefTypeSignature, a BaseTypeSignature, or an ArrayTypeSignature.
    • loadClass

      public Class<?> loadClass(boolean ignoreExceptions)
      Loads the referenced class, returning a Class<?> reference for the referenced class.
      Overrides:
      loadClass in class ScanResultObject
      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:
      IllegalArgumentException - if the class could not be loaded and ignoreExceptions was false.
    • loadClass

      public Class<?> loadClass()
      Loads the referenced class, returning a Class<?> reference for the referenced class.
      Overrides:
      loadClass in class ScanResultObject
      Returns:
      The Class<?> reference for the referenced class.
      Throws:
      IllegalArgumentException - if the class could not be loaded.
    • getClassName

      protected String getClassName()
      Description copied from class: ScanResultObject
      The name of the class (used by ScanResultObject.getClassInfo() to fetch the ClassInfo object for the class).
      Specified by:
      getClassName in class ScanResultObject
      Returns:
      The class name.
    • getClassInfo

      public ClassInfo getClassInfo()
      Get the class info.
      Overrides:
      getClassInfo in class ScanResultObject
      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 class ScanResultObject
      Parameters:
      scanResult - the scan result
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      protected void toString(boolean useSimpleNames, StringBuilder buf)
      Description copied from class: ScanResultObject
      Render to string.
      Specified by:
      toString in class ScanResultObject
      Parameters:
      useSimpleNames - if true, use just the simple name of each class.
      buf - the buf