class BusinessObjectDataKeyComparator implements Comparator<BusinessObjectDataKey>, Serializable {

    @Override
    public int compare(final BusinessObjectDataKey data1, final BusinessObjectDataKey data2)
    {
        if (data1 == null || data2 == null)
        {
            return data1 == null && data2 == null ? 0 : (data1 == null ? -1 : 1);
        }
        int result = ObjectUtils.compare(data1.getBusinessObjectDefinitionName(), data2.getBusinessObjectDefinitionName());
        if (result != 0)
        {
            return result;
        }
        result = ObjectUtils.compare(data1.getBusinessObjectFormatUsage(), data2.getBusinessObjectFormatUsage());
        if (result != 0)
        {
            return result;
        }
        result = ObjectUtils.compare(data1.getBusinessObjectFormatFileType(), data2.getBusinessObjectFormatFileType());
        if (result != 0)
        {
            return result;
        }
        result = ObjectUtils.compare(data1.getBusinessObjectFormatVersion(), data2.getBusinessObjectFormatVersion());
        if (result != 0)
        {
            return result;
        }
        result = ObjectUtils.compare(data1.getPartitionValue(), data2.getPartitionValue());
        if (result != 0)
        {
            return result;
        }
        return ObjectUtils.compare(data1.getBusinessObjectDataVersion(), data2.getBusinessObjectDataVersion());
    }

}