/** As {@link #approximately(Object, Object)} but testing all the arguments given. */ @Beta public static boolean approximately(Object o1, Object o2, Object o3, Object... oo) { if (!approximately(o1, o2)) return false; if (!approximately(o1, o3)) return false; for (Object o: oo) if (!approximately(o1, o)) return false; return true; }
/** Useful for debugging EqualsBuilder.reflectionEquals */ public static void dumpReflectiveEquals(Object o1, Object o2) { log.info("Comparing: "+o1+" "+o2); Class<?> clazz = o1.getClass(); while (!(clazz.equals(Object.class))) { log.info(" fields in: "+clazz); for (Field f: clazz.getDeclaredFields()) { f.setAccessible(true); try { log.info( " "+(Objects.equal(f.get(o1), f.get(o2)) ? "==" : "!=" ) + " "+ f.getName()+ " "+ f.get(o1) +" "+ f.get(o2) + " ("+ classOf(f.get(o1)) +" "+ classOf(f.get(o2)+")") ); } catch (Exception e) { Exceptions.propagateIfFatal(e); log.info( " <error> "+e); } } clazz = clazz.getSuperclass(); } }
if (Equals.approximately(val, oldVal)) {