package org.express4j.utils;

/**
 * Created by Song on 2015/12/26.
 */
public class ConvertUtils {

    public static Object convert(Class<?> cls ,Object value){
        if(Integer.class.isAssignableFrom(cls)){
            return Integer.parseInt((String) value);
        }

        if(Long.class.isAssignableFrom(cls)){
            return Long.parseLong((String) value);
        }

        if(Byte.class.isAssignableFrom(cls)){
            return Byte.parseByte((String) value);
        }

        if(Short.class.isAssignableFrom(cls)){
            return Short.parseShort((String) value);
        }

        if(Float.class.isAssignableFrom(cls)){
            return Float.parseFloat((String) value);
        }

        if(Boolean.class.isAssignableFrom(cls)){
            return Boolean.parseBoolean((String) value);
        }
        return cls.cast(value);
    }

}

@@ -699,32 +699,146 @@
 ue);%0A        %7D%0A%0A
+        if(Double.class.isAssignableFrom(cls))%7B%0A            return Double.parseDouble((String) value);%0A        %7D%0A%0A
         if(Boole

修复漏洞：不能转换Double类型