Class ArrayTypeSignature


public class ArrayTypeSignature extends ReferenceTypeSignature
An array type signature.
  • Field Details

    • scanResult

      protected transient ScanResult scanResult
      The scan result.
    • classRef

      protected transient Class<?> classRef
      The class ref, once the class is loaded.
  • Method Details

    • getTypeSignatureStr

      public String getTypeSignatureStr()
      Get the raw array type signature string, e.g. "[[I".
      Returns:
      the raw array type signature string.
    • getElementTypeSignature

      public TypeSignature getElementTypeSignature()
      Get the type signature of the innermost element type of the array.
      Returns:
      The type signature of the innermost element type.
    • getNumDimensions

      public int getNumDimensions()
      Get the number of dimensions of the array.
      Returns:
      The number of dimensions of the array.
    • getNestedType

      public TypeSignature getNestedType()
      Get the nested type, which is another ArrayTypeSignature with one dimension fewer, if this array has 2 or more dimensions, otherwise this returns the element type.
      Returns:
      The nested type.
    • addTypeAnnotation

      protected void addTypeAnnotation(List<io.github.classgraph.Classfile.TypePathNode> typePath, AnnotationInfo annotationInfo)
      Description copied from class: TypeSignature
      Add a type annotation to this type.
      Specified by:
      addTypeAnnotation in class TypeSignature
      Parameters:
      typePath - The type path.
      annotationInfo - The annotation to add.
    • getTypeAnnotationInfo

      public AnnotationInfoList getTypeAnnotationInfo()
      Get a list of AnnotationInfo objects for the type annotations on this array type, or null if none.
      Overrides:
      getTypeAnnotationInfo in class TypeSignature
      Returns:
      a list of AnnotationInfo objects for the type annotations of on this array type, or null if none.
      See Also:
    • getClassName

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

      protected ClassInfo getClassInfo()
    • getArrayClassInfo

      public ArrayClassInfo getArrayClassInfo()
      Return an ArrayClassInfo instance for the array class, cast to its superclass.
      Returns:
      the ArrayClassInfo instance.
    • findReferencedClassNames

      protected void findReferencedClassNames(Set<String> refdClassNames)
      Get the names of any classes referenced in the type signature.
      Overrides:
      findReferencedClassNames in class TypeSignature
      Parameters:
      refdClassNames - the referenced class names.
    • loadElementClass

      public Class<?> loadElementClass(boolean ignoreExceptions)
      Get a Class<?> reference for the innermost array element type. Causes the ClassLoader to load the class, if it is not already loaded.
      Parameters:
      ignoreExceptions - Whether or not to ignore exceptions.
      Returns:
      a Class<?> reference for the innermost array element type. Also works for arrays of primitive element type.
    • loadElementClass

      public Class<?> loadElementClass()
      Get a Class<?> reference for the array element type. Causes the ClassLoader to load the element class, if it is not already loaded.
      Returns:
      a Class<?> reference for the array element type. Also works for arrays of primitive element type.
    • loadClass

      public Class<?> loadClass(boolean ignoreExceptions)
      Obtain a Class<?> reference for the array class named by this ArrayClassInfo object. Causes the ClassLoader to load the element class, if it is not already loaded.
      Parameters:
      ignoreExceptions - Whether or not to ignore exceptions.
      Returns:
      The class reference, or null, if ignoreExceptions is true and there was an exception or error loading the class.
      Throws:
      IllegalArgumentException - if ignoreExceptions is false and there were problems loading the class.
    • loadClass

      public Class<?> loadClass()
      Obtain a Class<?> reference for the array class named by this ArrayClassInfo object. Causes the ClassLoader to load the element class, if it is not already loaded.
      Returns:
      The class reference.
      Throws:
      IllegalArgumentException - if there were problems loading the class.
    • hashCode

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

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

      public boolean equalsIgnoringTypeParams(TypeSignature other)
      Description copied from class: TypeSignature
      Compare base types, ignoring generic type parameters.
      Specified by:
      equalsIgnoringTypeParams in class TypeSignature
      Parameters:
      other - the other TypeSignature to compare to.
      Returns:
      True if the two TypeSignature objects are equal, ignoring type parameters.
    • toStringInternal

      protected void toStringInternal(boolean useSimpleNames, AnnotationInfoList annotationsToExclude, StringBuilder buf)
      Description copied from class: HierarchicalTypeSignature
      Render type signature to string.
      Specified by:
      toStringInternal in class HierarchicalTypeSignature
      Parameters:
      useSimpleNames - whether to use simple names for classes.
      annotationsToExclude - toplevel annotations to exclude, to eliminate duplication (toplevel annotations are both class/field/method annotations and type annotations).
      buf - the StringBuilder to write to.
    • toStringWithSimpleNames

      public String toStringWithSimpleNames()
      Render to string, using only simple names for classes.
      Returns:
      the string representation, using simple names for classes.
    • toString

      public String toString()
      Render to string.
      Overrides:
      toString in class Object
      Returns:
      the string representation.