public final class SetTextLineItemCustomField extends SetCustomFieldBase<ShoppingList>
See also ShoppingListInStoreUpdateCommand.
withUpdateableType(client(), type -> { final ShoppingListDraftDsl shoppingListDraft = newShoppingListDraftWithTextLineItem(1L); withShoppingList(client(), shoppingListDraft, shoppingList -> { final String textLineItemId = shoppingList.getTextLineItems().get(0).getId(); final String value = randomString(); final ShoppingList shoppingListWithCustomType = client().executeBlocking(ShoppingListUpdateCommand.of(shoppingList, SetTextLineItemCustomType.ofTypeIdAndObjects(type.getId(), STRING_FIELD_NAME, value, textLineItemId))); final String newValue = randomString(); final ShoppingList shoppingListWithCustomField = client().executeBlocking(ShoppingListUpdateCommand.of(shoppingListWithCustomType, SetTextLineItemCustomField.ofObject(STRING_FIELD_NAME, newValue, textLineItemId))); final TextLineItem updatedTextLineItem = shoppingListWithCustomField.getTextLineItems().get(0); assertThat(updatedTextLineItem.getCustom().getField(STRING_FIELD_NAME, TypeReferences.stringTypeReference())) .isEqualTo(newValue); return shoppingListWithCustomField; }); return type; });
See the test code.
Custom
Modifier and Type | Method and Description |
---|---|
String |
getTextLineItemId() |
static SetTextLineItemCustomField |
ofJson(String name,
com.fasterxml.jackson.databind.JsonNode value,
String textLineItemId) |
static SetTextLineItemCustomField |
ofObject(String name,
Object value,
String textLineItemId) |
static SetTextLineItemCustomField |
ofUnset(String name,
String textLineItemId) |
getName, getValue
getAction
public static SetTextLineItemCustomField ofJson(String name, com.fasterxml.jackson.databind.JsonNode value, String textLineItemId)
public static SetTextLineItemCustomField ofObject(String name, Object value, String textLineItemId)
public static SetTextLineItemCustomField ofUnset(String name, String textLineItemId)
public String getTextLineItemId()