public final class SetCustomField extends SetCustomFieldBase<ShippingMethod>
See also ShippingMethodUpdateCommand.
withUpdateableType(client(), type -> { withUpdateableShippingMethod(client(), shippingMethod -> { final SetCustomType updateAction = SetCustomType .ofTypeIdAndObjects(type.getId(), singletonMap(STRING_FIELD_NAME, "foo")); final ShippingMethod updatedShippingMethod = client().executeBlocking(ShippingMethodUpdateCommand.of(shippingMethod, updateAction)); assertThat(updatedShippingMethod.getCustom().getFieldAsString(STRING_FIELD_NAME)).isEqualTo("foo"); final ShippingMethod updatedShippingMethod2 = client().executeBlocking(ShippingMethodUpdateCommand.of(updatedShippingMethod, SetCustomField.ofObject(STRING_FIELD_NAME, "bar"))); assertThat(updatedShippingMethod2.getCustom().getFieldAsString(STRING_FIELD_NAME)).isEqualTo("bar"); return updatedShippingMethod2; }); return type; });
See the test code.
Custom
Modifier and Type | Method and Description |
---|---|
static SetCustomField |
ofJson(String name,
com.fasterxml.jackson.databind.JsonNode value) |
static SetCustomField |
ofObject(String name,
Object value) |
static SetCustomField |
ofUnset(String name) |
getName, getValue
getAction
public static SetCustomField ofJson(String name, com.fasterxml.jackson.databind.JsonNode value)
public static SetCustomField ofObject(String name, Object value)
public static SetCustomField ofUnset(String name)