public final class AddFieldDefinition extends UpdateActionImpl<Type>
Type
(NOT ProductType
).
See also TypeUpdateCommand.
withUpdateableType(client(), type -> { final String name = randomKey(); final FieldDefinition fieldDefinition = FieldDefinition.of(StringFieldType.of(), name, en("label"), false, TextInputHint.SINGLE_LINE); final Type updatedType = client().executeBlocking(TypeUpdateCommand.of(type, AddFieldDefinition.of(fieldDefinition))); assertThat(updatedType.getFieldDefinitionByName(name)).isEqualTo(fieldDefinition); assertThat(updatedType.getFieldDefinitions()).hasSize(type.getFieldDefinitions().size() + 1); final Type updated2 = client().executeBlocking(TypeUpdateCommand.of(updatedType, RemoveFieldDefinition.of(name))); assertThat(updated2.getFieldDefinitions()).hasSize(type.getFieldDefinitions().size()); return updated2; });
See the test code.
Modifier and Type | Method and Description |
---|---|
FieldDefinition |
getFieldDefinition() |
static AddFieldDefinition |
of(FieldDefinition fieldDefinition) |
getAction
public static AddFieldDefinition of(FieldDefinition fieldDefinition)
public FieldDefinition getFieldDefinition()