Package org.eclipse.mat.hprof
Class ExportHprof.Remap
java.lang.Object
org.eclipse.mat.hprof.ExportHprof.Remap
- Enclosing class:
- ExportHprof
Remaps class names.
Separate class to isolate the generation of names from the actual
contents of the snapshot.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
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.Return the renamed version of a classReturn the renamed version of a simple field/methodmapSignature
(String sig) Return the renamed version of a method/type signaturerenameClassName
(String classname) Renames a class.renameClassOrMethodName
(String classname) Renames a class, or a method pseudo-class.renameFileName
(String classname, String filename) Rename a file name based on a class name.renameMethodName
(String className, String method, boolean upper) Generate a new method name.renameSignature
(String signature) Rename a method signature.void
saveMapping
(File mapFile, boolean undo, String comments)
-
Constructor Details
-
Remap
Create a remapper- Parameters:
skipPattern
- Remap names unless they match thisavoidPattern
- Avoid remapping to names which match thismatchFields
- matvch field names across classesundo
- Just use existing remappings
-
-
Method Details
-
loadMapping
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
- if there is a problem reading the mapping file
-
saveMapping
- Throws:
IOException
-
isRemapped
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
Return the renamed version of a class- Parameters:
cn
-- Returns:
- null if not renamed
-
mapField
Return the renamed version of a simple field/method- Parameters:
cn
-- Returns:
- null if not renamed
-
mapSignature
Return the renamed version of a method/type signature- Parameters:
sig
- the signature- Returns:
- null if not renamed
-
renameFileName
Rename a file name based on a class name.- Parameters:
classname
- the class name in Memory Analyzer formatfilename
- the Java source file name- Returns:
- the renamed file name
-
renameSignature
Rename a method signature. Extract the class names from the Lpack1.class1;II)VLpack2.class2;- Parameters:
signature
- the method signature in Memory Analyzer format- Returns:
- renamed signature
-
renameMethodName
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
- the class name in Memory Analyzer formatmethod
- method name or field nameupper
- static field in upper case, else all lower case.- Returns:
- the renamed method or field name
-
renameClassName
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
- the class name in Memory Analyzer format- Returns:
- the renamed class name, or the original name if no renaming is to be done for this class
-
renameClassOrMethodName
Renames a class, or a method pseudo-class.- Parameters:
classname
- the class or class+method name- Returns:
- the renamed class name, or the original name if no renaming is to be done for this class
-