jetbrick-commons/src/main/java/jetbrick/typecast/TypeCastResolver.java
public <T> T convert(String value, Class<T> type) {
        // fast-path
        if (value == null) {
            return null;
        }
        if (type == String.class) {
            return (T) value;
        }
        // normal-path
        Convertor<T> c = (Convertor<T>) pool.get(type);
        if (c != null) {
            return c.convert(value);
        }
        if (type.isArray()) {
            return (T) convertToArray(value, type.getComponentType());
        }
        throw new IllegalStateException("Unsupported cast class: " + type.getName());
    }
public <T> T convert(String value, Class<T> type) {
        // fast-path
        if (value == null) {
            return null;
        }
        if (type == String.class) {
            return (T) value;
        }
        // normal-path
        Convertor<T> c = (Convertor<T>) pool.get(type);
        if (c != null) {
            return c.convert(value);
        }
        if (type.isArray()) {
            return (T) convertToArray(value, type.getComponentType());
        }
        throw new IllegalStateException("Unsupported cast class: " + type.getName());
    }
public < T > T convert ( String value , Class < T > type ) { // fast-path if ( value == null ) { return null ; } if ( type == String . class ) { return ( T ) value ; } // normal-path Convertor < T > c = ( Convertor < T > ) pool . get ( type ) ; if ( c != null ) { return c . convert ( value ) ; } if ( type . isArray ( ) ) { return ( T ) convertToArray ( value , type . getComponentType ( ) ) ; } throw new IllegalStateException ( "Unsupported cast class: " + type . getName ( ) ) ; }
-------- convert string -----------------------------------------------------------
-------- convert string -----------------------------------------------------------