private static Object parseObject(Class<?> cl, String s) throws Exception {
        //works with int, float, boolean, String 
        if (cl.getSimpleName().equals("int") || cl.getSimpleName().equals("Integer")) {
            return Integer.parseInt(s);
        } else if (cl.getSimpleName().equalsIgnoreCase("float")) {
            return Float.parseFloat(s);
        } else if (cl.getSimpleName().equals("String")) {
            return s;
        } else if (cl.getSimpleName().equalsIgnoreCase("boolean")) {
            return Boolean.parseBoolean(s);
        } else if (cl.isEnum()) {
            return cl.getMethod("valueOf", String.class).invoke(cl, s);
        } else {
            return null;
        }
    }