1 54 package org.logicalcobwebs.cglib.core; 55 56 import org.logicalcobwebs.asm.ClassAdapter; 57 import org.logicalcobwebs.asm.ClassReader; 58 59 public class ClassNameReader { 61 private ClassNameReader() { 62 } 63 64 private static final EarlyExitException EARLY_EXIT = new EarlyExitException(); 65 private static class EarlyExitException extends RuntimeException { } 66 67 public static String getClassName(ClassReader r) { 68 final String [] array = new String [1]; 69 try { 70 r.accept(new ClassAdapter(null) { 71 public void visit(int access, 72 String name, 73 String superName, 74 String [] interfaces, 75 String sourceFile) { 76 array[0] = name.replace('/', '.'); 77 throw EARLY_EXIT; 78 } 79 }, true); 80 } catch (EarlyExitException e) { } 81 return array[0]; 82 } 83 } 84 | Popular Tags |