Package edu.umd.cs.findbugs.classfile
Class ClassDescriptor
- java.lang.Object
-
- edu.umd.cs.findbugs.classfile.ClassDescriptor
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<ClassDescriptor>
- Direct Known Subclasses:
ClassNameAndSuperclassInfo
public class ClassDescriptor extends java.lang.Object implements java.lang.Comparable<ClassDescriptor>, java.io.Serializable
Descriptor identifying a class.- Author:
- David Hovemeyer
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static ClassDescriptor[]
EMPTY_ARRAY
-
Constructor Summary
Constructors Modifier Constructor Description protected
ClassDescriptor(java.lang.String className)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description int
compareTo(ClassDescriptor o)
static ClassDescriptor
createClassDescriptor(java.lang.String className)
Deprecated.UseDescriptorFactory.createClassDescriptor(String)
insteadstatic ClassDescriptor[]
createClassDescriptor(java.lang.String[] classNames)
Deprecated.static ClassDescriptor
createClassDescriptor(org.apache.bcel.classfile.JavaClass c)
Deprecated.static ClassDescriptor
createClassDescriptorFromDottedClassName(java.lang.String dottedClassName)
Deprecated.static ClassDescriptor
createClassDescriptorFromSignature(java.lang.String signature)
Deprecated.boolean
equals(java.lang.Object obj)
static ClassDescriptor
fromFieldSignature(java.lang.String signature)
Deprecated.static ClassDescriptor
fromResourceName(java.lang.String resourceName)
Deprecated.java.lang.String
getClassName()
java.lang.String
getDottedClassName()
Get the name of the class in dotted format.java.lang.String
getPackageName()
Get the name of the package in dotted format.java.lang.String
getSignature()
java.lang.String
getSimpleName()
Get the simple name of the classXClass
getXClass()
int
hashCode()
boolean
isAnonymousClass()
boolean
isArray()
static boolean
isClassResource(java.lang.String resourceName)
Deprecated.UseDescriptorFactory.isClassResource(String)
insteadboolean
matches(java.lang.Class<?> c)
static void
throwClassNotFoundException(ClassDescriptor classDescriptor)
Throw a ClassNotFoundException to indicate that class named by given ClassDescriptor cannot be found.java.lang.String
toDottedClassName()
Deprecated.usegetDottedClassName()
instead.java.lang.String
toResourceName()
Get the resource name of this class as it would appear in the classpath.java.lang.String
toString()
-
-
-
Field Detail
-
EMPTY_ARRAY
public static final ClassDescriptor[] EMPTY_ARRAY
-
-
Constructor Detail
-
ClassDescriptor
protected ClassDescriptor(@SlashedClassName java.lang.String className)
Constructor.- Parameters:
className
- class name in VM format, e.g. "java/lang/String"
-
-
Method Detail
-
getClassName
@SlashedClassName public final java.lang.String getClassName()
- Returns:
- Returns the class name in VM format, e.g. "java/lang/String"
-
compareTo
public int compareTo(ClassDescriptor o)
- Specified by:
compareTo
in interfacejava.lang.Comparable<ClassDescriptor>
-
matches
public boolean matches(java.lang.Class<?> c)
-
toResourceName
public java.lang.String toResourceName()
Get the resource name of this class as it would appear in the classpath. E.g., "java/lang/String.class"- Returns:
- the resource name
-
toDottedClassName
@Deprecated @DottedClassName public java.lang.String toDottedClassName()
Deprecated.usegetDottedClassName()
instead.Get the name of the class in dotted format.- Returns:
- the name of the class in dotted format
-
getDottedClassName
@DottedClassName public java.lang.String getDottedClassName()
Get the name of the class in dotted format.- Returns:
- the name of the class in dotted format
-
getXClass
public XClass getXClass() throws CheckedAnalysisException
- Throws:
CheckedAnalysisException
-
getPackageName
@DottedClassName public java.lang.String getPackageName()
Get the name of the package in dotted format.- Returns:
- the name of the package in dotted format
-
getSimpleName
public java.lang.String getSimpleName()
Get the simple name of the class- Returns:
- the simple name of the class
-
getSignature
public java.lang.String getSignature()
-
isArray
public boolean isArray()
-
fromResourceName
@Deprecated public static ClassDescriptor fromResourceName(java.lang.String resourceName)
Deprecated.Create a class descriptor from a resource name.- Parameters:
resourceName
- the resource name- Returns:
- the class descriptor
-
fromFieldSignature
@Deprecated @CheckForNull public static ClassDescriptor fromFieldSignature(java.lang.String signature)
Deprecated.Create a class descriptor from a field signature
-
isClassResource
@Deprecated public static boolean isClassResource(java.lang.String resourceName)
Deprecated.UseDescriptorFactory.isClassResource(String)
insteadDetermine whether or not the given resource name refers to a class.- Parameters:
resourceName
- the resource name- Returns:
- true if the resource is a class, false otherwise
-
createClassDescriptorFromSignature
@Deprecated public static ClassDescriptor createClassDescriptorFromSignature(java.lang.String signature)
Deprecated.
-
createClassDescriptor
@Deprecated public static ClassDescriptor createClassDescriptor(@SlashedClassName java.lang.String className)
Deprecated.UseDescriptorFactory.createClassDescriptor(String)
instead
-
createClassDescriptor
@Deprecated public static ClassDescriptor[] createClassDescriptor(java.lang.String[] classNames)
Deprecated.
-
createClassDescriptorFromDottedClassName
@Deprecated public static ClassDescriptor createClassDescriptorFromDottedClassName(java.lang.String dottedClassName)
Deprecated.
-
createClassDescriptor
@Deprecated public static ClassDescriptor createClassDescriptor(org.apache.bcel.classfile.JavaClass c)
Deprecated.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
equals
public final boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
throwClassNotFoundException
public static void throwClassNotFoundException(ClassDescriptor classDescriptor) throws java.lang.ClassNotFoundException
Throw a ClassNotFoundException to indicate that class named by given ClassDescriptor cannot be found. The exception message is formatted in a way that can be decoded by ClassNotFoundExceptionParser.- Parameters:
classDescriptor
- ClassDescriptor naming a class that cannot be found- Throws:
java.lang.ClassNotFoundException
- See Also:
ClassNotFoundExceptionParser
-
isAnonymousClass
public boolean isAnonymousClass()
-
-