1 4 package com.tc.aspectwerkz.reflect; 5 6 12 public class TypeConverter { 13 20 public static String [] convertTypeToJava(final Class [] types) { 21 String [] parameterTypeNames = new String [types.length]; 22 for (int i = 0; i < types.length; i++) { 23 parameterTypeNames[i] = convertTypeToJava(types[i]); 24 } 25 return parameterTypeNames; 26 } 27 28 34 public static String convertTypeToJava(final Class type) { 35 String rv = null; 36 37 if (type != null) { 39 StringBuffer dim = new StringBuffer (); 40 Class componentType = type.getComponentType(); 41 for (Class nestedType = type; nestedType.isArray(); nestedType = nestedType.getComponentType()) { 42 dim.append("[]"); 43 } 44 45 if (dim.length() > 0) { 47 rv = componentType.getName() + dim; 48 } else { 49 rv = type.getName(); 50 } 51 } else { 52 rv = "void"; 53 } 54 return rv; 55 } 56 } | Popular Tags |