Class BaseTypeSignature


  • public class BaseTypeSignature
    extends TypeSignature
    A type signature for a base type (byte, char, double, float, int, long, short, boolean, or void).
    • Field Detail

      • typeSignatureChar

        private final char typeSignatureChar
        The type signature character used to represent the base type.
    • Constructor Detail

      • BaseTypeSignature

        BaseTypeSignature​(char typeSignatureChar)
        Constructor.
    • Method Detail

      • getTypeStr

        static java.lang.String getTypeStr​(char typeChar)
        Get the name of the type as a string.
        Parameters:
        typeChar - the type character, e.g. 'I'.
        Returns:
        The name of the type, e.g. "int", or null if there was no match.
      • getTypeChar

        static char getTypeChar​(java.lang.String typeStr)
        Get the name of the type as a string.
        Parameters:
        typeStr - the type character, e.g. "int".
        Returns:
        The type, character, e.g. 'I', or '\0' if there was no match.
      • getType

        static java.lang.Class<?> getType​(char typeChar)
        Get the type for a type character.
        Parameters:
        typeChar - the type character, e.g. 'I'.
        Returns:
        The type class, e.g. int.class, or null if there was no match.
      • getTypeSignatureChar

        public char getTypeSignatureChar()
        Get the type signature char used to represent the type, e.g. 'I' for int.
        Returns:
        the type signature char, as a one-char String.
      • getTypeStr

        public java.lang.String getTypeStr()
        Get the name of the type as a string.
        Returns:
        The name of the type, such as "int", "float", or "void".
      • getType

        public java.lang.Class<?> getType()
        Get the type.
        Returns:
        The class of the base type, such as int.class, float.class, or void.class.
      • loadClass

        <T> java.lang.Class<T> loadClass​(java.lang.Class<T> superclassOrInterfaceType)
        Description copied from class: ScanResultObject
        Load the class named returned by ScanResultObject.getClassInfo(), or if that returns null, the class named by ScanResultObject.getClassName(). Returns a Class<?> reference for the class, cast to the requested superclass or interface type.
        Overrides:
        loadClass in class ScanResultObject
        Type Parameters:
        T - the superclass or interface type
        Parameters:
        superclassOrInterfaceType - The type to cast the resulting class reference to.
        Returns:
        The Class<?> reference for the referenced class, or null if the class could not be loaded (or casting failed) and ignoreExceptions is true.
      • parse

        static BaseTypeSignature parse​(Parser parser)
        Parse a base type.
        Parameters:
        parser - the parser
        Returns:
        the base type signature
      • getClassInfo

        protected ClassInfo getClassInfo()
        Description copied from class: ScanResultObject
        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). N.B. even if this method returns null, ScanResultObject.loadClass() may be able to load the referenced class by name.
        Overrides:
        getClassInfo in class ScanResultObject
        Returns:
        The ClassInfo object for the referenced class.
      • findReferencedClassNames

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

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

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • toStringInternal

        protected void toStringInternal​(boolean useSimpleNames,
                                        AnnotationInfoList annotationsToExclude,
                                        java.lang.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.