@Override
    public int compare(ProductCanonicalCondition o1, ProductCanonicalCondition o2) {
      ProductCanonicalConditionCondition condition1 = o1.getCondition();
      ProductCanonicalConditionCondition condition2 = o2.getCondition();

      if (condition1 == condition2) {
        return 0;
      }

      // If one condition is null but not the other, order so that the null object will be last.
      int result = NULLS_LAST_OBJECT_ORDERING.compare(condition1, condition2);
      if (result != 0) {
        return result;
      }

      return NULLS_LAST_NATURAL_ORDERING.compare(condition1.getValue(), condition2.getValue());
    }
 /**
  * Creates a new ProductCanonicalCondition.
  *
  * @param condition may be null if creating an "other" dimension
  */
 public static ProductCanonicalCondition createCanonicalCondition(
     @Nullable ProductCanonicalConditionCondition condition) {
   ProductCanonicalCondition productCanonicalCondition = new ProductCanonicalCondition();
   productCanonicalCondition.setCondition(condition);
   return productCanonicalCondition;
 }