@Override public int compare(ProductCustomAttribute o1, ProductCustomAttribute o2) { int result = NULLS_LAST_DIMENSION_TYPE_ORDERING.compare(o1.getType(), o2.getType()); if (result != 0) { return result; } return NULLS_LAST_CASE_INSENSITIVE_ORDERING.compare(o1.getValue(), o2.getValue()); }
/** * Creates a new ProductCustomAttribute. * * @param productDimensionType required * @param attributeValue may be null if creating an "other" dimension */ public static ProductCustomAttribute createCustomAttribute( ProductDimensionType productDimensionType, @Nullable String attributeValue) { Preconditions.checkNotNull( productDimensionType, "ProductDimensionType is required when creating a ProductCustomAttribute"); ProductCustomAttribute productCustomAttribute = new ProductCustomAttribute(); productCustomAttribute.setType(productDimensionType); productCustomAttribute.setValue(attributeValue); return productCustomAttribute; }