From 703ab39780d866f8e962ca2942aa952d654cb7ed Mon Sep 17 00:00:00 2001 From: wangjingsheng Date: Thu, 3 Mar 2022 16:44:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E6=97=A0=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pms/ocp/common/utils/JSONCopyUtil.java | 66 ------------------- 1 file changed, 66 deletions(-) delete mode 100644 src/main/java/com/pms/ocp/common/utils/JSONCopyUtil.java diff --git a/src/main/java/com/pms/ocp/common/utils/JSONCopyUtil.java b/src/main/java/com/pms/ocp/common/utils/JSONCopyUtil.java deleted file mode 100644 index 3bdd2c4..0000000 --- a/src/main/java/com/pms/ocp/common/utils/JSONCopyUtil.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.pms.ocp.common.utils; - -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONArray; -import org.apache.commons.lang3.StringUtils; - -import java.util.List; - -/** - * @ClassName: JSONCopyUtil - * @Author: laizonghao - * @Description: 基于fastjson的实体复制工具类 - * @Date: 2020/9/12 15:12 - */ -public class JSONCopyUtil { - - /** - * 对象复制 - * @param o - * @param clazz - * @param - * @return - */ - public static T copyObject(Object o, Class clazz) { - return JSON.parseObject(JSON.toJSONString(o), clazz); - } - - public static T copyObject(String jsonString, Class clazz) { - return JSON.parseObject(jsonString, clazz); - } - - /** - * List复制 - * @param o - * @param clazz - * @param - * @return - */ - public static List copyArray(Object o, Class clazz) { - return JSONArray.parseArray(JSON.toJSONString(o), clazz); - } - - public static List copyArray(String jsonString, Class clazz) { - return JSONArray.parseArray(jsonString, clazz); - } - - - /** - * 从文本中提取数据 - * @param str - * @return - */ - public static String getStringNum(String str) { - str = str.trim(); - StringBuilder str2 = new StringBuilder(); - if (StringUtils.isNotBlank(str)) { - for (int i = 0; i < str.length(); i++) { - //加一个分隔符判断 - 45 , 44 - if ((str.charAt(i) >= 48 && str.charAt(i) <= 57) || str.charAt(i) == 44 || str.charAt(i) == 45) { - str2.append(str.charAt(i)); - } - } - } - return str2.toString(); - } -} -- 2.26.0