All Downloads are FREE. Search and download functionalities are using the official Maven repository.

arp.repository.compare.JavaObjectFieldComparator Maven / Gradle / Ivy

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);
		}
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy