/*** 将驼峰式命名的字符串转换为下划线方式* @param camelCase* @return*/ private static String toUnderlineCase(String camelCase) {return StrUtil.toUnderlineCase(camelCase); }
/*** 下划线-赋值给-驼峰* @param source 源数据* @param target 目标数据*/ public static List copyHumpToLineValue(JSONArray source, Class target) {try {List<Object> list = new ArrayList<>();for (int i = 0; i < source.size(); i++) {Object object = target.newInstance();JSONObject jsonObject = source.getJSONObject(i);Field[] targetFields = object.getClass().getDeclaredFields();for (Field targetField : targetFields) {if (!targetField.isAccessible()) {targetField.setAccessible(true);}String name = targetField.getName();String underlineCase = toUnderlineCase(name);targetFiel