org.nakedobjects.noa.reflect.NullUtils Maven / Gradle / Ivy
The newest version!
package org.nakedobjects.noa.reflect;
import org.nakedobjects.noa.adapter.Naked;
public class NullUtils {
public static boolean nullSafeEquals(
Object previous,
Object value) {
if (previous == null && value == null) return true;
if (previous == null || value == null) return false;
if (previous.equals(value)) return true;
if (previous instanceof Naked && value instanceof Naked) {
Naked previousNV = (Naked) previous;
Naked valueNV = (Naked) value;
return nullSafeEquals(previousNV.getObject(), valueNV.getObject());
}
return false;
}
}