合并两个相同对象的属性值,类似于js的extend方法(Merge the property values of two identical objects, similar to the extend method of JS).docVIP
- 38
- 0
- 约7.59千字
- 约 17页
- 2017-10-05 发布于河南
- 举报
合并两个相同对象的属性值,类似于js的extend方法(Merge the property values of two identical objects, similar to the extend method of JS)
合并两个相同对象的属性值,类似于js的extend方法(Merge the property values of two identical objects, similar to the extend method of JS)
Merge the property values of two identical objects, similar to the extend method of JS
Xiao Yao released on 2012, 04, 03, 1, 10 comments /677 read share to Sina, micro-blog, Tencent, micro-blog collection, +3 step top 0
Merge the property values of two identical objects, similar to the extend method of JS
Tags: no code fragment (1)
[Code] [Java] code
View sourceprint? 001 / / help me Tidianyixian.
002 package cn.utils;
003
004 import java.beans.BeanInfo;
005 import java.beans.IntrospectionException;
006 import java.beans.Introspector;
007 import java.beans.PropertyDescriptor;
008 import java.lang.reflect.InvocationTargetException;
009 import java.sql.Timestamp;
010 import java.text.ParseException;
011 import java.text.SimpleDateFormat;
012 import java.util.ArrayList;
013 import java.util.Date;
014 import java.util.Iterator;
015 import java.util.List;
016 import java.util.Map;
017 import java.util.regex.Pattern;
018
019 import mons.beanutils.BeanUtils;
020
021
022, public, class, ExtendObject {
023
024 / * *
025 * merge the contents of the same type of objects to the right
026 * @param beanType returns the type of object
027 * @param initObject contains the object of the original data
028 * @param updateObject contains the object of the modified data
029 * @return returns the combination of two objects, the value of the same property, if it contains, and is not null, the value of it, otherwise the value of convertedObject is taken, or else the value of returnedObject is taken
030.
031 @SuppressWarnings (unchecked)
032, public, Object, extendObject (Object, beanType, Object, initObject, Object, updateObject) {
033 Map MAP1 = BeanToMap (initObject);
034 Map MAP2 = BeanToMap (updateObject);
035 List list = getMapKeySet (MAP1);
036 for (int i=0; ilist.size (); i++) {
037 Object map2Value = map2.get (list.get (I));
038 if (null, =map2Value) {
039 map1.put
您可能关注的文档
- 初学演讲应处理好的四种关系(Four relations that should be dealt with in a beginner's speech).doc
- 初恋瞬间(First love moment).doc
- 初级会计·专题一 交易性金融资产与长期股权投资(Junior accountant Topic transactional financial assets and long-term equity investments).doc
- 初生婴儿如何护理(How do you care for a newborn baby).doc
- 初级水电工理论知识试题(别人的)(Elementary hydropower theory knowledge test questions (for others)).doc
- 删除字符(Delete character).doc
- 初二语文期末模拟试题24034(Second language final exam questions 24034).doc
- 初二语文期末模拟试题21754(Second language final exam questions 21754).doc
- 删除网维大师广告(Delete web master ad).doc
- 判断北斗七星与北极星的位置(Judge the position of the big dipper and the North Star).doc
原创力文档

文档评论(0)