MCPcopy Index your code
hub / github.com/beanshell/beanshell / normalizeClassName

Method normalizeClassName

src/bsh/Reflect.java:785–800  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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 /**

Callers 4

normalizeClassNameMethod · 0.95
throwTypeErrorMethod · 0.95
castPrimitiveMethod · 0.95
castErrorMethod · 0.95

Calls 5

getArrayBaseTypeMethod · 0.95
getArrayDimensionsMethod · 0.95
appendMethod · 0.80
getNameMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected