public interface TypeCreateCommand extends DraftBasedCreateCommandDsl<Type,TypeDraft,TypeCreateCommand>, MetaModelReferenceExpansionDsl<Type,TypeCreateCommand,TypeExpansionModel<Type>>
Type
.
final FieldDefinition stringFieldDefinition = FieldDefinition.of(StringFieldType.of(), "string-field-name", en("label"), false, TextInputHint.SINGLE_LINE); final String typeKey = "type-key"; final TypeDraft typeDraft = TypeDraftBuilder.of(typeKey, en("name of the custom type"), singleton(Category.referenceTypeId())) .description(en("description")) .fieldDefinitions(singletonList(stringFieldDefinition)) .build(); final Type type = client().executeBlocking(TypeCreateCommand.of(typeDraft)); assertThat(type.getKey()).isEqualTo(typeKey); assertThat(type.getName()).isEqualTo(en("name of the custom type")); assertThat(type.getResourceTypeIds()).containsExactly(Category.referenceTypeId()); assertThat(type.getDescription()).isEqualTo(en("description")); assertThat(type.getFieldDefinitions()).containsExactly(stringFieldDefinition);
See the test code.
Modifier and Type | Method and Description |
---|---|
static TypeCreateCommand |
of(TypeDraft draft)
Creates a command object to create a
Type . |
getDraft, withDraft
canDeserialize, deserialize, httpRequestIntent
plusExpansionPaths, withExpansionPaths
plusExpansionPaths, plusExpansionPaths, plusExpansionPaths, plusExpansionPaths, withExpansionPaths, withExpansionPaths, withExpansionPaths, withExpansionPaths
expansionPaths
static TypeCreateCommand of(TypeDraft draft)
Type
.draft
- template to create the new object