public final class SetLineItemCustomField extends SetCustomFieldBase<ShoppingList>
See also ShoppingListInStoreUpdateCommand.
withUpdateableType(client(), type -> { withTaxedProduct(client(), product -> { final ShoppingListDraftDsl shoppingListDraft = newShoppingListDraftWithLineItem(product, 1L); withShoppingList(client(), shoppingListDraft, shoppingList -> { final String lineItemId = shoppingList.getLineItems().get(0).getId(); final String value = randomString(); final ShoppingList shoppingListWithCustomType = client().executeBlocking(ShoppingListUpdateCommand.of(shoppingList, SetLineItemCustomType.ofTypeIdAndObjects(type.getId(), STRING_FIELD_NAME, value, lineItemId))); final String newValue = randomString(); final ShoppingList shoppingListWithLineCustomField = client().executeBlocking(ShoppingListUpdateCommand.of(shoppingListWithCustomType, SetLineItemCustomField.ofObject(STRING_FIELD_NAME, newValue, lineItemId))); final CustomFields custom = shoppingListWithLineCustomField.getLineItems().get(0).getCustom(); assertThat(custom.getField(STRING_FIELD_NAME, TypeReferences.stringTypeReference())) .isEqualTo(newValue); return shoppingListWithLineCustomField; }); }); return type; });
See the test code.
Custom
Modifier and Type | Method and Description |
---|---|
String |
getLineItemId() |
static SetLineItemCustomField |
ofJson(String name,
com.fasterxml.jackson.databind.JsonNode value,
String lineItemId) |
static SetLineItemCustomField |
ofObject(String name,
Object value,
String lineItemId) |
static SetLineItemCustomField |
ofUnset(String name,
String lineItemId) |
getName, getValue
getAction
public static SetLineItemCustomField ofJson(String name, com.fasterxml.jackson.databind.JsonNode value, String lineItemId)
public static SetLineItemCustomField ofObject(String name, Object value, String lineItemId)
public static SetLineItemCustomField ofUnset(String name, String lineItemId)
public String getLineItemId()