有没有Java反射实用程序做两个对象的深度比较? [英] Is there a Java reflection utility to do a deep comparison of two objects?

查看:100
本文介绍了有没有Java反射实用程序做两个对象的深度比较?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在大型项目中为各种clone()操作编写单元测试和
我想知道是否有一个现有的类,能够获取两个相同类型的对象,做一个深入的比较,并说他们是否相同?

I'm trying to write unit tests for a variety of clone() operations inside a large project and I'm wondering if there is an existing class somewhere that is capable of taking two objects of the same type, doing a deep comparison, and saying if they're identical or not?

推荐答案

«Apache commons-lang»有反思based equals builder在此处记录: org.apache.commons.lang3.builder.EqualsBuilder

«Apache commons-lang» has a reflection based equals builder documented here: org.apache.commons.lang3.builder.EqualsBuilder.

这篇关于有没有Java反射实用程序做两个对象的深度比较?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆