Package serp.bytecode
Class NameCache
java.lang.Object
serp.bytecode.NameCache
Caching and conversion of names in both internal and external form.
- Author:
- Abe White
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clear the cache.getComponentName
(String name) Return the component type name for the given array type, or null if the given string does not represent an array type name.getDescriptor
(String returnType, String[] paramTypes) Construct a method descriptor from the given return and parameter types, which will be converted to internal form.String[]
getDescriptorParamNames
(String descriptor) Return the parameter types, in internal form, for the given method descriptor string.getDescriptorReturnName
(String descriptor) Return the return type, in internal form, for the given method descriptor string.getExternalForm
(String internalName, boolean humanReadable) Given the internal name of the class, return the 'normal' java name.getInternalForm
(String className, boolean descriptor) Converts the given class name to its internal form.
-
Constructor Details
-
NameCache
public NameCache()
-
-
Method Details
-
getInternalForm
Converts the given class name to its internal form.- Parameters:
className
- the name to convertdescriptor
- true if the name is to be used for a descriptor section -- the difference seems to be that for descriptors, non-primitives are prefixed with 'L' and ended with ';'
-
getExternalForm
Given the internal name of the class, return the 'normal' java name.- Parameters:
internalName
- the internal name being usedhumanReadable
- if the returned name should be in human-readable form, rather than a form suitable for aClass.forName(java.lang.String)
call -- the difference lies in the handling of arrays
-
getDescriptor
Construct a method descriptor from the given return and parameter types, which will be converted to internal form. -
getDescriptorReturnName
Return the return type, in internal form, for the given method descriptor string. -
getDescriptorParamNames
Return the parameter types, in internal form, for the given method descriptor string. -
getComponentName
Return the component type name for the given array type, or null if the given string does not represent an array type name. The name given should be in properClass.forName(java.lang.String)
form. -
clear
public void clear()Clear the cache.
-