Return a more human readable version of the type name. Specifically, array types are returned with postfix "[]" dimensions. e.g. return "int []" for integer array instead of "class [I" as would be returned by Class getName() in that case.
(Class type)
| 783 | * would be returned by Class getName() in that case. |
| 784 | */ |
| 785 | public static String normalizeClassName(Class type) { |
| 786 | if (!type.isArray()) { |
| 787 | return type.getName(); |
| 788 | } |
| 789 | StringBuilder className = new StringBuilder(); |
| 790 | try { |
| 791 | className.append(getArrayBaseType(type).getName()).append(' '); |
| 792 | for (int i = 0; i < getArrayDimensions(type); i++) { |
| 793 | className.append("[]"); |
| 794 | } |
| 795 | } catch (ReflectError e) { |
| 796 | /*shouldn't happen*/ |
| 797 | } |
| 798 | |
| 799 | return className.toString(); |
| 800 | } |
| 801 | |
| 802 | |
| 803 | /** |
no test coverage detected