@Override
    public int compare(ENTITY o1, ENTITY o2) {
        final V o1Value = field.get(requireNonNull(o1));
        final V o2Value = field.get(requireNonNull(o2));
        
        if (o1Value == null && o2Value == null) {
            if (NullOrder.NONE == nullOrder) {
                throw new NullPointerException(
                    "Both fields were null and null fields not allowed"
                );
            }
            return 0;
        } else if (o1Value == null) {
            return forNull(Parameter.FIRST);
        } else if (o2Value == null) {
            return forNull(Parameter.SECOND);
        }
        
        return applyReversed(o1Value.compareTo(o2Value));
    }
The default implementation of the {@link ReferenceFieldComparator} interface.

@param <ENTITY>  the entity type
@param <D>       the database type
@param <V>       the value type

@author  Per Minborg
@author  Emil Forslund
@since   2.2.0
runtime-parent/runtime-field/src/main/java/com/speedment/runtime/field/internal/comparator/ReferenceFieldComparatorImpl.java