arp.repository.compare.JavaObjectFieldComparator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ARP Show documentation
Show all versions of ARP Show documentation
a java development framework with aggregation, repository and process
The newest version!
package arp.repository.compare;
import java.lang.reflect.Field;
import arp.util.Unsafe;
public class JavaObjectFieldComparator extends BaseFieldComparator {
public JavaObjectFieldComparator(Field field) {
super(field);
}
@Override
public boolean equals(T one, T another) {
Object oneObjectField = Unsafe.getObjectFieldOfObject(one, fieldOffset);
Object anotherObjectField = Unsafe.getObjectFieldOfObject(another, fieldOffset);
if (oneObjectField == null) {
return anotherObjectField == null;
} else {
return oneObjectField.equals(anotherObjectField);
}
}
}