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 protectedClassDescriptor(java.lang.String className)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description intcompareTo(ClassDescriptor o)static ClassDescriptorcreateClassDescriptor(java.lang.String className)Deprecated.UseDescriptorFactory.createClassDescriptor(String)insteadstatic ClassDescriptor[]createClassDescriptor(java.lang.String[] classNames)Deprecated.static ClassDescriptorcreateClassDescriptor(org.apache.bcel.classfile.JavaClass c)Deprecated.static ClassDescriptorcreateClassDescriptorFromDottedClassName(java.lang.String dottedClassName)Deprecated.static ClassDescriptorcreateClassDescriptorFromSignature(java.lang.String signature)Deprecated.booleanequals(java.lang.Object obj)static ClassDescriptorfromFieldSignature(java.lang.String signature)Deprecated.static ClassDescriptorfromResourceName(java.lang.String resourceName)Deprecated.java.lang.StringgetClassName()java.lang.StringgetDottedClassName()Get the name of the class in dotted format.java.lang.StringgetPackageName()Get the name of the package in dotted format.java.lang.StringgetSignature()java.lang.StringgetSimpleName()Get the simple name of the classXClassgetXClass()inthashCode()booleanisAnonymousClass()booleanisArray()static booleanisClassResource(java.lang.String resourceName)Deprecated.UseDescriptorFactory.isClassResource(String)insteadbooleanmatches(java.lang.Class<?> c)static voidthrowClassNotFoundException(ClassDescriptor classDescriptor)Throw a ClassNotFoundException to indicate that class named by given ClassDescriptor cannot be found.java.lang.StringtoDottedClassName()Get the name of the class in dotted format.java.lang.StringtoResourceName()Get the resource name of this class as it would appear in the classpath.java.lang.StringtoString()
-
-
-
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:
compareToin 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
@DottedClassName public java.lang.String toDottedClassName()
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:
toStringin classjava.lang.Object
-
equals
public final boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein 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()
-
-