jetbrick-commons/src/main/java/jetbrick/beans/ClassLoaderUtils.java
public static String getCanonicalClassName(String qualifiedClassName) {
        Validate.notNull(qualifiedClassName, "qualifiedClassName must be not null");

        String name = StringUtils.deleteWhitespace(qualifiedClassName);
        if (name.endsWith("[]")) {
            StringBuilder sb = new StringBuilder();

            while (name.endsWith("[]")) {
                name = name.substring(0, name.length() - 2);
                sb.append('[');
            }

            String abbreviation = abbreviationMap.get(name);
            if (abbreviation != null) {
                sb.append(abbreviation);
            } else {
                sb.append('L').append(name).append(';');
            }

            name = sb.toString();
        }
        return name;
    }
public static String getCanonicalClassName(String qualifiedClassName) {
        Validate.notNull(qualifiedClassName, "qualifiedClassName must be not null");

        String name = StringUtils.deleteWhitespace(qualifiedClassName);
        if (name.endsWith("[]")) {
            StringBuilder sb = new StringBuilder();

            while (name.endsWith("[]")) {
                name = name.substring(0, name.length() - 2);
                sb.append('[');
            }

            String abbreviation = abbreviationMap.get(name);
            if (abbreviation != null) {
                sb.append(abbreviation);
            } else {
                sb.append('L').append(name).append(';');
            }

            name = sb.toString();
        }
        return name;
    }
public static String getCanonicalClassName ( String qualifiedClassName ) { Validate . notNull ( qualifiedClassName , "qualifiedClassName must be not null" ) ; String name = StringUtils . deleteWhitespace ( qualifiedClassName ) ; if ( name . endsWith ( "[]" ) ) { StringBuilder sb = new StringBuilder ( ) ; while ( name . endsWith ( "[]" ) ) { name = name . substring ( 0 , name . length ( ) - 2 ) ; sb . append ( ' ' ) ; } String abbreviation = abbreviationMap . get ( name ) ; if ( abbreviation != null ) { sb . append ( abbreviation ) ; } else { sb . append ( ' ' ) . append ( name ) . append ( ' ' ) ; } name = sb . toString ( ) ; } return name ; }
将 Java 类名转为 {@code Class.forName()} 可以载入的类名格式.
<pre>
getCanonicalClassName("int") == "int";
getCanonicalClassName("int[]") == "[I";
getCanonicalClassName("java.lang.String") == "java.lang.String";
getCanonicalClassName("java.lang.String[]") == "[Ljava.lang.String;";
</pre>
将 Java 类名转为 {