1 45 package org.exolab.jms.plugins.proxygen; 46 47 48 54 public class ClassHelper { 55 56 59 private ClassHelper() { 60 } 61 62 63 71 protected static String getPackage(Class clazz) { 72 String result = null; 73 if (clazz.getPackage() != null) { 74 result = clazz.getPackage().getName(); 75 } else { 76 int lastDot = clazz.getName().lastIndexOf("."); 77 if (lastDot != -1) { 78 result = clazz.getName().substring(0, lastDot); 79 } 80 } 81 return result; 82 } 83 84 90 protected static String getQualifiedName(Class clazz) { 91 String result = null; 92 if (clazz.isArray()) { 93 result = ""; 94 while (clazz.isArray()) { 95 result += "[]"; 96 clazz = clazz.getComponentType(); 97 } 98 result = clazz.getName() + result; 99 } else { 100 result = clazz.getName(); 101 } 102 return result; 103 } 104 105 } 106 | Popular Tags |