1 15 16 package javassist; 17 18 import javassist.bytecode.Descriptor; 19 20 47 public class ClassMap extends java.util.HashMap { 48 58 public void put(CtClass oldname, CtClass newname) { 59 put(oldname.getName(), newname.getName()); 60 } 61 62 71 public void put(String oldname, String newname) { 72 if (oldname == newname) 73 return; 74 75 String oldname2 = toJvmName(oldname); 76 String s = (String )get(oldname2); 77 if (s == null || !s.equals(oldname2)) 78 super.put(oldname2, toJvmName(newname)); 79 } 80 81 protected final void put0(Object oldname, Object newname) { 82 super.put(oldname, newname); 83 } 84 85 95 public Object get(Object jvmClassName) { 96 return super.get(jvmClassName); 97 } 98 99 102 public void fix(CtClass clazz) { 103 fix(clazz.getName()); 104 } 105 106 109 public void fix(String name) { 110 String name2 = toJvmName(name); 111 super.put(name2, name2); 112 } 113 114 118 public static String toJvmName(String classname) { 119 return Descriptor.toJvmName(classname); 120 } 121 122 126 public static String toJavaName(String classname) { 127 return Descriptor.toJavaName(classname); 128 } 129 } 130 | Popular Tags |