比较同一类型,两个对象中不同的属性值
1 | /** |
1 | /** |
显示结果:
1 | [ |
把对象的属性名转化成中文展示
1 | /** |
1 | /** |
显示结果:
1 | 姓名:小草;年纪:18;性别:女;住址:上海 |
自定义对象属性非空验证
未引用 vavr 依赖的写法
1 | /** |
1 | /** |
1 | /** |
1 | /** |
1 | /** |
1 | /** |
1 | /** |
1 | /** |
1 | /** |
引用 vavr 依赖的写法
1 | <!-- lombok --> |
1 | /** |
1 | /** |
1 | /** |
1 | /** |
1 | /** |
测试
1 | /** |
结果显示相同
1 | FieldError(fieldName=partnerCode, errorMsg=企业编码不能为空, resultCode=PARTNER_CODE_NOT_EMPTY) |
补充断言比较两个集合是否相同
1 | /** |
案例源码:https://github.com/V-Vincen/reflect
If you like this blog or find it useful for you, you are welcome to comment on it. You are also welcome to share this blog, so that more people can participate in it. If the images used in the blog infringe your copyright, please contact the author to delete them. Thank you !