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
public abstract class JavaQualifiedName extends java.lang.Object implements net.sourceforge.pmd.lang.ast.QualifiedNameUnambiguous 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()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected abstract intbuildHashCode()Computes the hashcode.protected abstract java.lang.StringbuildToString()Construct the toString once.booleanequals(java.lang.Object o)java.lang.String[]getClasses()Deprecated.abstract JavaTypeQualifiedNamegetClassName()java.lang.StringgetClassSimpleName()Deprecated.java.lang.StringgetOperation()Deprecated.java.lang.String[]getPackages()Deprecated.inthashCode()booleanisLocalClass()Deprecated.booleanisUnnamedPackage()Deprecated.static JavaQualifiedNameofClass(java.lang.Class<?> clazz)Deprecated.static JavaQualifiedNameofString(java.lang.String name)Deprecated.protected abstract booleanstructurallyEquals(JavaQualifiedName qname)Returns true if the given qname is identical to this qname.java.lang.StringtoString()Returns the string representation of this qualified name.
-
-
-
Method Detail
-
getClassName
public abstract JavaTypeQualifiedName getClassName()
- 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 java.lang.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 java.lang.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 java.lang.String[] getPackages()
Deprecated.UseJavaTypeQualifiedName.getPackageList()()}. Will be removed in 7.0.0Returns the packages in order.
-
getClasses
@Deprecated public java.lang.String[] getClasses()
Deprecated.Use {JavaTypeQualifiedName.getClassList(). Will be removed in 7.0.0Returns the classes in order.
-
equals
public final boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
structurallyEquals
protected abstract boolean structurallyEquals(JavaQualifiedName qname)
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
-
hashCode
public final int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
buildHashCode
protected abstract int buildHashCode()
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 java.lang.String toString()
Returns the string representation of this qualified name. The representation follows the format defined forQualifiedNameFactory.ofString(String).- Specified by:
toStringin interfacenet.sourceforge.pmd.lang.ast.QualifiedName- Overrides:
toStringin classjava.lang.Object
-
ofString
@Deprecated public static JavaQualifiedName ofString(java.lang.String name)
Deprecated.UseQualifiedNameFactory.ofString(String). Will be removed in 7.0.0
-
ofClass
@Deprecated public static JavaQualifiedName ofClass(java.lang.Class<?> clazz)
Deprecated.UseQualifiedNameFactory.ofClass(Class). Will be removed in 7.0.0
-
buildToString
protected abstract java.lang.String buildToString()
Construct the toString once. Called only once per instance
-
-