Package edu.umd.cs.findbugs.classfile
Class DescriptorFactory
java.lang.Object
edu.umd.cs.findbugs.classfile.DescriptorFactory
Factory for creating ClassDescriptors, MethodDescriptors, and
FieldDescriptors.
- Author:
- David Hovemeyer
-
Method Summary
Modifier and TypeMethodDescriptionvoidvoidstatic Stringstatic voidstatic ClassDescriptorcreateClassDescriptor(Class<?> aClass) static ClassDescriptorcreateClassDescriptor(String className) static ClassDescriptor[]createClassDescriptor(String[] classNames) static ClassDescriptorcreateClassDescriptor(org.apache.bcel.classfile.JavaClass c) static ClassDescriptorcreateClassDescriptorFromDottedClassName(String dottedClassName) static ClassDescriptorcreateClassDescriptorFromFieldSignature(String signature) Create a class descriptor from a field signaturestatic ClassDescriptorcreateClassDescriptorFromResourceName(String resourceName) Create a class descriptor from a resource name.static ClassDescriptorcreateClassDescriptorFromSignature(String signature) static ClassDescriptorcreateClassOrObjectDescriptorFromSignature(String signature) getClassDescriptor(Class<?> actualClass) getClassDescriptor(String className) Get a ClassDescriptor for a class name in VM (slashed) format.static ClassDescriptorgetClassDescriptor(org.apache.bcel.generic.ObjectType type) Get a ClassDescriptor for the class described by given ObjectType object.getClassDescriptorForDottedClassName(String dottedClassName) Get a ClassDescriptor for a class name in dotted format.getFieldDescriptor(String className, String name, String signature, boolean isStatic) Get a FieldDescriptor.getFieldDescriptor(String className, org.apache.bcel.classfile.Field ma) getMethodDescriptor(String className, String name, String signature, boolean isStatic) Get a MethodDescriptor.getMethodDescriptor(org.apache.bcel.classfile.JavaClass jClass, org.apache.bcel.classfile.Method method) static DescriptorFactoryinstance()Get the singleton instance of the DescriptorFactory.static booleanisClassResource(String resourceName) Determine whether or not the given resource name refers to a class.voidprofile()voidpurge(Collection<ClassDescriptor> unusable)
-
Method Details
-
canonicalizeString
-
instance
Get the singleton instance of the DescriptorFactory.- Returns:
- the singleton instance of the DescriptorFactory
-
clearInstance
public static void clearInstance() -
getAllClassDescriptors
-
purge
-
getClassDescriptor
-
getClassDescriptor
Get a ClassDescriptor for a class name in VM (slashed) format.- Parameters:
className- a class name in VM (slashed) format- Returns:
- ClassDescriptor for that class
-
getClassDescriptorForDottedClassName
public ClassDescriptor getClassDescriptorForDottedClassName(@DottedClassName String dottedClassName) Get a ClassDescriptor for a class name in dotted format.- Parameters:
dottedClassName- a class name in dotted format- Returns:
- ClassDescriptor for that class
-
getMethodDescriptor
public MethodDescriptor getMethodDescriptor(org.apache.bcel.classfile.JavaClass jClass, org.apache.bcel.classfile.Method method) -
getMethodDescriptor
public MethodDescriptor getMethodDescriptor(@SlashedClassName String className, String name, String signature, boolean isStatic) Get a MethodDescriptor.- Parameters:
className- name of the class containing the method, in VM format (e.g., "java/lang/String")name- name of the methodsignature- signature of the methodisStatic- true if method is static, false otherwise- Returns:
- MethodDescriptor
-
profile
public void profile() -
canonicalize
-
canonicalize
-
getMethodDescriptor
-
getFieldDescriptor
public FieldDescriptor getFieldDescriptor(@SlashedClassName String className, String name, String signature, boolean isStatic) Get a FieldDescriptor.- Parameters:
className- the name of the class the field belongs to, in VM format (e.g., "java/lang/String")name- the name of the fieldsignature- the field signature (type)isStatic- true if field is static, false if not- Returns:
- FieldDescriptor
-
getFieldDescriptor
public FieldDescriptor getFieldDescriptor(@SlashedClassName String className, org.apache.bcel.classfile.Field ma) -
getFieldDescriptor
-
getClassDescriptor
Get a ClassDescriptor for the class described by given ObjectType object.- Parameters:
type- an ObjectType- Returns:
- a ClassDescriptor for the class described by the ObjectType
-
createClassDescriptor
-
createClassDescriptorFromResourceName
Create a class descriptor from a resource name.- Parameters:
resourceName- the resource name- Returns:
- the class descriptor
-
createClassDescriptorFromFieldSignature
@CheckForNull public static ClassDescriptor createClassDescriptorFromFieldSignature(String signature) Create a class descriptor from a field signature -
isClassResource
Determine 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
-
createClassOrObjectDescriptorFromSignature
-
createClassDescriptor
-
createClassDescriptor
-
createClassDescriptor
-
createClassDescriptorFromDottedClassName
-