1 8 package com.tc.backport175.bytecode; 9 10 import com.tc.asm.Type; 11 12 import java.lang.reflect.Constructor ; 13 import java.lang.reflect.Method ; 14 import java.lang.reflect.Field ; 15 16 21 public class SignatureHelper { 22 28 public static String getConstructorSignature(final Constructor constructor) { 29 Class [] paramTypes = constructor.getParameterTypes(); 31 StringBuffer buf = new StringBuffer (); 32 buf.append('('); 33 for (int i = 0; i < paramTypes.length; i++) { 34 buf.append(Type.getDescriptor(paramTypes[i])); 35 } 36 buf.append(')'); 37 buf.append(Type.VOID_TYPE.getDescriptor()); 38 return buf.toString(); 39 } 40 41 47 public static String getMethodSignature(final Method method) { 48 return Type.getMethodDescriptor(method); 49 } 50 51 57 public static String getFieldSignature(final Field field) { 58 return Type.getDescriptor(field.getType()); 59 } 60 61 67 public static String getClassSignature(Class klass) { 68 return Type.getDescriptor(klass); 69 } 70 71 } 72 | Popular Tags |