本文共 3314 字,大约阅读时间需要 11 分钟。
BeanMapping是什么? 请查看我之前的一篇文章:
目前代码经过在一个实际项目中进行试用,该项目为公司的核心业务逻辑(产品页面数据),目前表现良好。
在原先的1.0.0版本基础上修复了几个bug,目前推荐使用1.0.1。
url :
mvn仓库:
1.2. com.googlecode.mapping4java 3.mapping 4.1.0.1 5.
1.3. 4. 5. 11. 12.6. 7. 8. 9. 10. 13. 16. 17.14. 15.
1.public BeanMapping srcMapping = BeanMapping.create(SrcMappingObject.class, TargetMappingObject.class); 2.public BeanMapping targetMapping = BeanMapping.create(TargetMappingObject.class , SrcMappingObject.class); 3. 4. @Test 5. public void testBeanToBean_ok() { 6. SrcMappingObject srcRef = new SrcMappingObject(); 7. srcRef.setIntegerValue(1); 8. srcRef.setIntValue(1); 9. srcRef.setName("ljh"); 10. srcRef.setStart(true); 11. 12. TargetMappingObject targetRef = new TargetMappingObject();// 测试一下mapping到一个Object对象 13. srcMapping.mapping(srcRef, targetRef); 14. 15. SrcMappingObject newSrcRef = new SrcMappingObject();// 反过来再mapping一次 16. targetMapping.mapping(targetRef, newSrcRef); 17. }
1.public BeanCopy srcCopy = BeanCopy.create(SrcMappingObject.class, TargetMappingObject.class); 2. public BeanCopy targetCopy = BeanCopy.create(TargetMappingObject.class , SrcMappingObject.class); 3. 4. @Test 5. public void testBeanToBean_ok() { 6. SrcMappingObject srcRef = new SrcMappingObject(); 7. srcRef.setIntegerValue(1); 8. srcRef.setIntValue(1); 9. srcRef.setName("ljh"); 10. srcRef.setStart(true); 11. 12. TargetMappingObject targetRef = new TargetMappingObject();// 测试一下mapping到一个Object对象 13. srcCopy.copy(srcRef, targetRef); 14. 15. SrcMappingObject newSrcRef = new SrcMappingObject();// 反过来再mapping一次 16. targetCopy.copy(targetRef, newSrcRef); 17. }
1. public BeanMap beanMap = BeanMap.create(SrcMappingObject.class); 2. 3. @Test 4. public void testDescribe_Populate_ok() { 5. SrcMappingObject srcRef = new SrcMappingObject(); 6. srcRef.setIntegerValue(1); 7. srcRef.setIntValue(1); 8. srcRef.setName("ljh"); 9. srcRef.setStart(true); 10. 11. Map map = beanMap.describe(srcRef); 12. 13. SrcMappingObject newSrcRef = new SrcMappingObject();// 反过来再mapping一次 14. beanMap.populate(newSrcRef, map); 15. }
1.Release 1.0.1 2. "this" symbol GetExecutor bugfix 3. boolean isSuccessed generated set/get methods for the isSucessed()/setSuccessed(), should filter attribute is the prefix 4. Add date and sqlDate convertor 5. Add String and Enum convertor 6. Add mapping.propertis define ValueProcess plugins 7. 8.Release 1.0.0 9. Initial mapping code
转载地址:http://gtszx.baihongyu.com/