public final class SetCustomField extends SetCustomFieldBase<Channel>
See also ChannelUpdateCommand.
withUpdateableType(client(), type -> { final CustomFieldsDraft customFieldsDraft = CustomFieldsDraftBuilder.ofType(type) .addObject(STRING_FIELD_NAME, "a value") .build(); final ChannelDraft channelDraft = ChannelDraft.of(randomKey()).withCustom(customFieldsDraft); final Channel channel = client().executeBlocking(ChannelCreateCommand.of(channelDraft)); assertThat(channel.getCustom().getFieldAsString(STRING_FIELD_NAME)) .isEqualTo("a value"); final ChannelUpdateCommand channelUpdateCommand = ChannelUpdateCommand.of(channel, SetCustomField.ofObject(STRING_FIELD_NAME, "a new value")); final Channel updatedChannel = client().executeBlocking(channelUpdateCommand); assertThat(updatedChannel.getCustom() .getFieldAsString(STRING_FIELD_NAME)).isEqualTo("a new value"); //clean up client().executeBlocking(ChannelDeleteCommand.of(updatedChannel)); 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)