Class JavaQualifiedName
- java.lang.Object
-
- net.sourceforge.pmd.lang.java.ast.JavaQualifiedName
-
- All Implemented Interfaces:
net.sourceforge.pmd.lang.ast.QualifiedName
- Direct Known Subclasses:
JavaOperationQualifiedName,JavaTypeQualifiedName
@Deprecated public abstract class JavaQualifiedName extends Object implements net.sourceforge.pmd.lang.ast.QualifiedName
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 (seeQualifiedNameFactory.ofString(String)).Instances of this class are immutable. They can be obtained from the factory methods of
QualifiedNameFactory, or fromJavaQualifiableNode.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 Summary
Constructors Constructor Description JavaQualifiedName()Deprecated.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected abstract intbuildHashCode()Deprecated.Computes the hashcode.protected abstract StringbuildToString()Deprecated.Construct the toString once.booleanequals(Object o)Deprecated.String[]getClasses()Deprecated.abstract JavaTypeQualifiedNamegetClassName()Deprecated.StringgetClassSimpleName()Deprecated.StringgetOperation()Deprecated.String[]getPackages()Deprecated.inthashCode()Deprecated.booleanisLocalClass()Deprecated.booleanisUnnamedPackage()Deprecated.static JavaQualifiedNameofClass(Class<?> clazz)Deprecated.static JavaQualifiedNameofString(String name)Deprecated.protected abstract booleanstructurallyEquals(JavaQualifiedName qname)Deprecated.Returns true if the given qname is identical to this qname.StringtoString()Deprecated.Returns the string representation of this qualified name.
-
-
-
Method Detail
-
getClassName
public abstract JavaTypeQualifiedName getClassName()
Deprecated.- Specified by:
getClassNamein interfacenet.sourceforge.pmd.lang.ast.QualifiedName
-
isLocalClass
@Deprecated public boolean isLocalClass()
Deprecated.UseJavaTypeQualifiedName.isLocalClass(). Will be removed in 7.0.0Returns true if this qualified name identifies a local class.
-
getClassSimpleName
@Deprecated public String getClassSimpleName()
Deprecated.UseJavaTypeQualifiedName.getClassSimpleName(). Will be removed in 7.0.0Get the simple name of the class.
-
isUnnamedPackage
@Deprecated public boolean isUnnamedPackage()
Deprecated.UseJavaTypeQualifiedName.isUnnamedPackage(). Will be removed in 7.0.0Returns true if the class represented by this qualified name is in the unnamed package.
-
getOperation
@Deprecated public String getOperation()
Deprecated.UseJavaOperationQualifiedName.getOperation(). Will be removed in 7.0.0Returns the operation specific part of the name. It identifies an operation in its namespace. ReturnsnullifQualifiedName.isOperation()returns false.- Returns:
- The operation string, or
null.
-
getPackages
@Deprecated public String[] getPackages()
Deprecated.UseJavaTypeQualifiedName.getPackageList()()}. Will be removed in 7.0.0Returns the packages in order.
-
getClasses
@Deprecated public String[] getClasses()
Deprecated.Use {JavaTypeQualifiedName.getClassList(). Will be removed in 7.0.0Returns the classes in order.
-
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 ofequals(Object)after taking shortcuts.- Parameters:
qname- The other comparand. Can always be casted down to the subclass type in which this method is overridden
-
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.
-
toString
public final String toString()
Deprecated.Returns the string representation of this qualified name. The representation follows the format defined forQualifiedNameFactory.ofString(String).
-
ofString
@Deprecated public static JavaQualifiedName ofString(String name)
Deprecated.UseQualifiedNameFactory.ofString(String). Will be removed in 7.0.0
-
ofClass
@Deprecated public static JavaQualifiedName ofClass(Class<?> clazz)
Deprecated.UseQualifiedNameFactory.ofClass(Class). Will be removed in 7.0.0
-
buildToString
protected abstract String buildToString()
Deprecated.Construct the toString once. Called only once per instance
-
-