Package org.eclipse.mat.hprof
Class ExportHprof.Remap
- java.lang.Object
-
- org.eclipse.mat.hprof.ExportHprof.Remap
-
- Enclosing class:
- ExportHprof
public static class ExportHprof.Remap extends Object
Remaps class names. Separate class to isolate the generation of names from the actual contents of the snapshot.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isRemapped(String cn)
Is the class name one which should have a new name invented?void
loadMapping(File mapFile, boolean undo)
Load the existing mapping table from a mapping properties file.String
mapClass(String cn)
Return the renamed version of a classString
mapField(String cn)
Return the renamed version of a simple field/methodString
mapSignature(String sig)
Return the renamed version of a method/type signatureString
renameClassName(String classname)
Renames a class.String
renameFileName(String classname, String filename)
Rename a file name based on a class name.String
renameMethodName(String className, String method, boolean upper)
Generate a new method name.String
renameSignature(String signature)
Rename a method signature.void
saveMapping(File mapFile, boolean undo, String comments)
-
-
-
Method Detail
-
loadMapping
public void loadMapping(File mapFile, boolean undo) throws IOException
Load the existing mapping table from a mapping properties file. Properties file format: original.package.Classname=new.package.Classname- Parameters:
mapFile
- the Java format properties fileundo
- whether to reverse the mappings contained in the file- Throws:
IOException
-
saveMapping
public void saveMapping(File mapFile, boolean undo, String comments) throws IOException
- Throws:
IOException
-
isRemapped
public boolean isRemapped(String cn)
Is the class name one which should have a new name invented?- Parameters:
cn
-- Returns:
- true if the class name is to be changed
-
mapClass
public String mapClass(String cn)
Return the renamed version of a class- Parameters:
cn
-- Returns:
- null if not renamed
-
mapField
public String mapField(String cn)
Return the renamed version of a simple field/method- Parameters:
cn
-- Returns:
- null if not renamed
-
mapSignature
public String mapSignature(String sig)
Return the renamed version of a method/type signature- Parameters:
sig
-- Returns:
- null if not renamed
-
renameFileName
public String renameFileName(String classname, String filename)
Rename a file name based on a class name.- Parameters:
classname
-filename
-- Returns:
- the renamed file name
-
renameSignature
public String renameSignature(String signature)
Rename a method signature. Extract the class names from the Lpack1.class1;II)VLpack2.class2;- Parameters:
signature
-- Returns:
- renamed signature
-
renameMethodName
public String renameMethodName(String className, String method, boolean upper)
Generate a new method name. Remember it as package.class^method - ? Some unusual Javac generated methods: HistogramQuery$Grouping.values() HistogramQuery.$SWITCH_TABLE$org$eclipse$mat$inspections$HistogramQuery$Grouping()- Parameters:
className
-method
- method name or field nameupper
- static field in upper case, else all lower case.- Returns:
- the renamed method or field name
-
renameClassName
public String renameClassName(String classname)
Renames a class. Break into component parts, reusing existing mapping for package if already used. Removes array suffixes and uses base class name. Translates inner classes with '$' piece by piece, reusing existing mapping of outer class.- Parameters:
classname
-- Returns:
- the renamed class name, or the original name if no renaming is to be done for this class
-
-