Class JavaTypeQualifiedName

  • All Implemented Interfaces:
    net.sourceforge.pmd.lang.ast.QualifiedName

    public final class JavaTypeQualifiedName
    extends JavaQualifiedName
    Specialises JavaQualifiedName for type names.
    Since:
    6.1.0
    Author:
    Clément Fournier
    • Method Detail

      • buildHashCode

        protected int buildHashCode()
        Description copied from class: JavaQualifiedName
        Computes the hashcode. Called once, then cached. Since QualifiedNames are mostly used as the keys of a map, caching the hashcode makes sense.
        Specified by:
        buildHashCode in class JavaQualifiedName
      • isClass

        public boolean isClass()
      • isOperation

        public boolean isOperation()
      • isLocalClass

        public boolean isLocalClass()
        Returns true if this qualified name identifies a local class.
        Overrides:
        isLocalClass in class JavaQualifiedName
      • isAnonymousClass

        public boolean isAnonymousClass()
        Returns true if this qualified name identifies an anonymous class.
      • isUnnamedPackage

        public boolean isUnnamedPackage()
        Returns true if the class represented by this qualified name is in the unnamed package.
        Overrides:
        isUnnamedPackage in class JavaQualifiedName
      • getPackageList

        public java.util.List<java.lang.String> getPackageList()
        Returns the packages in outer-to-inner order. This is specific to Java's package structure. If the outer class is in the unnamed package, returns an empty list.

        @NotNull

        Returns:
        The packages.
      • getClassList

        public java.util.List<java.lang.String> getClassList()
        Returns the class specific part of the name. It identifies a class in the namespace it's declared in. If the class is nested inside another, then the list returned contains all enclosing classes in order, from outermost to innermost.

        @NotNull

        Returns:
        The class names.
      • getType

        public java.lang.Class<?> getType()
        Gets the Class instance identified by this qualified name.
        Returns:
        A class instance, or null if the classloader threw a ClassNotFoundException or LinkageError while trying to load the class.
      • getBinaryName

        public java.lang.String getBinaryName()
        Returns the binary name of the type identified by this qualified name. The binary name can be used to load a Class using a ClassLoader. Contrary to this method, JavaQualifiedName.toString() is not guaranteed to return a binary name. For most purposes, you should avoid using this method directly and use getType() instead. Just don't build a dependency on the toString if you want a binary name.
        Returns:
        The binary name of the type identified by this qualified name