Class JavaQualifiedName

  • Direct Known Subclasses:
    JavaOperationQualifiedName, JavaTypeQualifiedName

    @Deprecated
    public abstract class JavaQualifiedName
    extends Object
    Deprecated.
    This class and subclasses will be removed in PMD 7.0 for lack of usefulness. JavaQualifiedName cannot be used to represent unknown entities, because in Java source, the only thing we can observe are *canonical* names, which eg don't exist for local classes, and can be ambiguous between a member class and a package name.

    So you can't build a conformant JavaQualifiedName without having parsed the source file where the entity is. But since you have parsed the file, you have much better data structures than JavaQualifiedName to reflect the content of the program: you have nodes. So we can do away with this class.

    Unambiguous identifier for a java method or class. This implementation approaches the qualified name format found in stack traces for example, using a custom format specification (see QualifiedNameFactory.ofString(String)).

    Instances of this class are immutable. They can be obtained from the factory methods of QualifiedNameFactory, or from JavaQualifiableNode.getQualifiedName() on AST nodes that support it.

    Class qualified names follow the binary name spec.

    Method qualified names don't follow a specification but allow to distinguish overloads of the same method, using parameter types and order.

    Since:
    5.8.1
    Author:
    Clément Fournier
    See Also:
    JavaTypeQualifiedName, JavaOperationQualifiedName
    • Constructor Detail

      • JavaQualifiedName

        public JavaQualifiedName()
        Deprecated.
    • Method Detail

      • getClassName

        public abstract JavaTypeQualifiedName getClassName()
        Deprecated.
        Returns the qualified name of the class the resource is located in. If this instance addresses a class, returns this instance.
        Returns:
        The qualified name of the class
      • equals

        public final boolean equals​(Object o)
        Deprecated.
        Overrides:
        equals in class Object
      • structurallyEquals

        protected abstract boolean structurallyEquals​(JavaQualifiedName qname)
        Deprecated.
        Returns true if the given qname is identical to this qname. Performs a structural comparison. Used in the implementation of equals(Object) after taking shortcuts.
        Parameters:
        qname - The other comparand. Can always be casted down to the subclass type in which this method is overridden
      • hashCode

        public final int hashCode()
        Deprecated.
        Overrides:
        hashCode in class Object
      • buildHashCode

        protected abstract int buildHashCode()
        Deprecated.
        Computes the hashcode. Called once, then cached. Since QualifiedNames are mostly used as the keys of a map, caching the hashcode makes sense.
      • isClass

        public abstract boolean isClass()
        Deprecated.
        Returns true if the resource addressed by this qualified name is a class.
        Returns:
        true if the resource addressed by this qualified name is a class.
      • isOperation

        public abstract boolean isOperation()
        Deprecated.
        Returns true if the resource addressed by this qualified name is an operation.
        Returns:
        true if the resource addressed by this qualified name is an operation.
      • buildToString

        protected abstract String buildToString()
        Deprecated.
        Construct the toString once. Called only once per instance