public static SetCustomField ofJson(final String name, final JsonNode value) { return new SetCustomField(name, value); }
public static SetCustomField ofUnset(final String name) { return ofJson(name, null); } }
@Test public void createCartWithCustomType() { withUpdateableType(client(), type -> { final CustomFieldsDraft customFieldsDraft = CustomFieldsDraftBuilder.ofType(type).addObject(STRING_FIELD_NAME, "a value").build(); final CartDraft categoryDraft = CartDraftBuilder.of(EUR).country(CountryCode.DE).custom(customFieldsDraft).build(); final Cart category = client().executeBlocking(CartCreateCommand.of(categoryDraft)); assertThat(category.getCustom().getField(STRING_FIELD_NAME, TypeReferences.stringTypeReference())).isEqualTo("a value"); final Cart updatedCart = client().executeBlocking(CartUpdateCommand.of(category, SetCustomField.ofObject(STRING_FIELD_NAME, "a new value"))); assertThat(updatedCart.getCustom().getField(STRING_FIELD_NAME, TypeReferences.stringTypeReference())).isEqualTo("a new value"); //cleanup client().executeBlocking(CartDeleteCommand.of(updatedCart)); return type; }); }
public static SetCustomField ofUnset(final String name) { return ofJson(name, null); } }
public static SetCustomField ofJson(final String name, final JsonNode value) { return new SetCustomField(name, value); }
public static SetCustomField ofUnset(final String name) { return ofJson(name, null); } }
public static SetCustomField ofJson(final String name, final JsonNode value) { return new SetCustomField(name, value); }
public static SetCustomField ofObject(final String name, final Object value) { final JsonNode jsonNode = SphereJsonUtils.toJsonNode(value); return ofJson(name, jsonNode); }
public static SetCustomField ofObject(final String name, final Object value) { final JsonNode jsonNode = SphereJsonUtils.toJsonNode(value); return ofJson(name, jsonNode); }
public static SetCustomField ofObject(final String name, final Object value) { final JsonNode jsonNode = SphereJsonUtils.toJsonNode(value); return ofJson(name, jsonNode); }