From d07a8e7e587a3d56921a86f7720bbce26759dc81 Mon Sep 17 00:00:00 2001 From: XuZiKun Date: Mon, 6 May 2019 18:10:42 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BC=98=E5=8C=96Map=E5=AF=B9=E8=B1=A1?= =?UTF-8?q?=E7=9A=84=E5=88=9B=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/nh/micro/ext/ExtBeanWrapper.java | 123 +++++++++--------- 1 file changed, 63 insertions(+), 60 deletions(-) diff --git a/extcol/src/main/java/com/nh/micro/ext/ExtBeanWrapper.java b/extcol/src/main/java/com/nh/micro/ext/ExtBeanWrapper.java index 264c3eb..89eab0d 100644 --- a/extcol/src/main/java/com/nh/micro/ext/ExtBeanWrapper.java +++ b/extcol/src/main/java/com/nh/micro/ext/ExtBeanWrapper.java @@ -1,60 +1,63 @@ -package com.nh.micro.ext; - - -import java.util.HashMap; -import java.util.Map; -import com.alibaba.fastjson.JSON; - -/** - * - * @Description: - * @Author: ninghao - * @Date: 2019年3月4日 - * @Version: 1.0 - */ -public class ExtBeanWrapper { - - public ExtBeanWrapper() { - }; - - public ExtBeanWrapper(Object entity) { - this.setObj(entity); - } - - private Map innerMap = new HashMap(); - - public Map getInnerMap() { - return innerMap; - } - - public void setInnerMap(Map innerMap) { - this.innerMap = innerMap; - } - - public void setObj(Object entity) { - if (entity == null) { - innerMap = null; - } - JSON jobj = (JSON) JSON.toJSON(entity); - innerMap = JSON.toJavaObject(jobj, Map.class); - } - - public Object getObj() { - if (innerMap == null) { - return null; - } - JSON jobj = (JSON) JSON.toJSON(innerMap); - Map entity = JSON.toJavaObject(jobj, Map.class); - return entity; - } - - public Object getObj(Class targetClass) { - if (innerMap == null) { - return null; - } - JSON jobj = (JSON) JSON.toJSON(innerMap); - Object entity = JSON.toJavaObject(jobj, targetClass); - return entity; - } - -} +package com.nh.micro.ext; + +import java.util.HashMap; +import java.util.Map; +import com.alibaba.fastjson.JSON; + +/** + * + * @Description: + * @Author: ninghao + * @Date: 2019年3月4日 + * @Version: 1.0 + */ +public class ExtBeanWrapper { + + public ExtBeanWrapper() { + }; + + public ExtBeanWrapper(Object entity) { + this.setObj(entity); + } + + private Map innerMap = new HashMap(); + + public Map getInnerMap() { + return innerMap; + } + + public void setInnerMap(Map innerMap) { + this.innerMap = innerMap; + } + + public void setObj(Object entity) { + if (entity == null) { + innerMap = null; + } + if (entity instanceof Map) { + innerMap = (Map) entity; + } else { + JSON jobj = (JSON) JSON.toJSON(entity); + innerMap = JSON.toJavaObject(jobj, Map.class); + } + } + + public Object getObj() { + if (innerMap == null) { + return null; + } + JSON jobj = (JSON) JSON.toJSON(innerMap); + Map entity = JSON.toJavaObject(jobj, Map.class); + return entity; + } + + public Object getObj(Class targetClass) { + if (innerMap == null) { + return null; + } + JSON jobj = (JSON) JSON.toJSON(innerMap); + Object entity = JSON.toJavaObject(jobj, targetClass); + return entity; + } + +} From 27080f03e4cd7e8b910b9078f275636967bbb12d Mon Sep 17 00:00:00 2001 From: XuZiKun Date: Mon, 6 May 2019 18:10:42 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BC=98=E5=8C=96Wrapper=E5=AF=B9=E8=B1=A1?= =?UTF-8?q?=E7=9A=84=E5=88=9B=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/nh/micro/ext/ExtBeanWrapper.java | 123 +++++++++--------- 1 file changed, 63 insertions(+), 60 deletions(-) diff --git a/extcol/src/main/java/com/nh/micro/ext/ExtBeanWrapper.java b/extcol/src/main/java/com/nh/micro/ext/ExtBeanWrapper.java index 264c3eb..89eab0d 100644 --- a/extcol/src/main/java/com/nh/micro/ext/ExtBeanWrapper.java +++ b/extcol/src/main/java/com/nh/micro/ext/ExtBeanWrapper.java @@ -1,60 +1,63 @@ -package com.nh.micro.ext; - - -import java.util.HashMap; -import java.util.Map; -import com.alibaba.fastjson.JSON; - -/** - * - * @Description: - * @Author: ninghao - * @Date: 2019年3月4日 - * @Version: 1.0 - */ -public class ExtBeanWrapper { - - public ExtBeanWrapper() { - }; - - public ExtBeanWrapper(Object entity) { - this.setObj(entity); - } - - private Map innerMap = new HashMap(); - - public Map getInnerMap() { - return innerMap; - } - - public void setInnerMap(Map innerMap) { - this.innerMap = innerMap; - } - - public void setObj(Object entity) { - if (entity == null) { - innerMap = null; - } - JSON jobj = (JSON) JSON.toJSON(entity); - innerMap = JSON.toJavaObject(jobj, Map.class); - } - - public Object getObj() { - if (innerMap == null) { - return null; - } - JSON jobj = (JSON) JSON.toJSON(innerMap); - Map entity = JSON.toJavaObject(jobj, Map.class); - return entity; - } - - public Object getObj(Class targetClass) { - if (innerMap == null) { - return null; - } - JSON jobj = (JSON) JSON.toJSON(innerMap); - Object entity = JSON.toJavaObject(jobj, targetClass); - return entity; - } - -} +package com.nh.micro.ext; + +import java.util.HashMap; +import java.util.Map; +import com.alibaba.fastjson.JSON; + +/** + * + * @Description: + * @Author: ninghao + * @Date: 2019年3月4日 + * @Version: 1.0 + */ +public class ExtBeanWrapper { + + public ExtBeanWrapper() { + }; + + public ExtBeanWrapper(Object entity) { + this.setObj(entity); + } + + private Map innerMap = new HashMap(); + + public Map getInnerMap() { + return innerMap; + } + + public void setInnerMap(Map innerMap) { + this.innerMap = innerMap; + } + + public void setObj(Object entity) { + if (entity == null) { + innerMap = null; + } + if (entity instanceof Map) { + innerMap = (Map) entity; + } else { + JSON jobj = (JSON) JSON.toJSON(entity); + innerMap = JSON.toJavaObject(jobj, Map.class); + } + } + + public Object getObj() { + if (innerMap == null) { + return null; + } + JSON jobj = (JSON) JSON.toJSON(innerMap); + Map entity = JSON.toJavaObject(jobj, Map.class); + return entity; + } + + public Object getObj(Class targetClass) { + if (innerMap == null) { + return null; + } + JSON jobj = (JSON) JSON.toJSON(innerMap); + Object entity = JSON.toJavaObject(jobj, targetClass); + return entity; + } + +}