public final class SetCustomType extends SetCustomTypeBase<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 SetCustomType |
ofRemoveType() |
static SetCustomType |
ofTypeIdAndJson(String typeId,
Map<String,com.fasterxml.jackson.databind.JsonNode> fields) |
static SetCustomType |
ofTypeIdAndObjects(String typeId,
Map<String,Object> fields) |
static SetCustomType |
ofTypeKeyAndJson(String typeKey,
Map<String,com.fasterxml.jackson.databind.JsonNode> fields) |
static SetCustomType |
ofTypeKeyAndObjects(String typeKey,
Map<String,Object> fields) |
getFields, getType, mapObjectToJsonMap
getAction
public static SetCustomType ofTypeKeyAndObjects(String typeKey, Map<String,Object> fields)
public static SetCustomType ofTypeIdAndObjects(String typeId, Map<String,Object> fields)
public static SetCustomType ofTypeIdAndJson(String typeId, Map<String,com.fasterxml.jackson.databind.JsonNode> fields)
public static SetCustomType ofTypeKeyAndJson(String typeKey, Map<String,com.fasterxml.jackson.databind.JsonNode> fields)
public static SetCustomType ofRemoveType()