Class FieldDefinitionBuilder
- All Implemented Interfaces:
Builder<FieldDefinition>
Example to create an instance using the builder pattern
FieldDefinition fieldDefinition = FieldDefinition.builder()
.type(typeBuilder -> typeBuilder)
.name("{name}")
.label(labelBuilder -> labelBuilder)
.required(true)
.build()
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
builds FieldDefinition with checking for non-null required valuesbuilds FieldDefinition without checking for non-null required valuesDefines the visual representation of the field in user interfaces like the Merchant Center.getLabel()
A human-readable label for the field.getName()
Name of the Custom Field to define.Defines whether the field is required to have a value.getType()
Data type of the Custom Field to define.inputHint
(TypeTextInputHint inputHint) Defines the visual representation of the field in user interfaces like the Merchant Center.label
(LocalizedString label) A human-readable label for the field.A human-readable label for the field.Name of the Custom Field to define.static FieldDefinitionBuilder
of()
factory method for an instance of FieldDefinitionBuilderstatic FieldDefinitionBuilder
of
(FieldDefinition template) create builder for FieldDefinition instanceDefines whether the field is required to have a value.Data type of the Custom Field to define.type
(Function<FieldTypeBuilder, Builder<? extends FieldType>> builder) Data type of the Custom Field to define.A human-readable label for the field.
-
Constructor Details
-
FieldDefinitionBuilder
public FieldDefinitionBuilder()
-
-
Method Details
-
type
Data type of the Custom Field to define.
- Parameters:
type
- value to be set- Returns:
- Builder
-
type
Data type of the Custom Field to define.
- Parameters:
builder
- function to build the type value- Returns:
- Builder
-
name
Name of the Custom Field to define. Must be unique for a given ResourceTypeId. In case there is a FieldDefinition with the same
name
in another Type, both FieldDefinitions must have the sametype
.- Parameters:
name
- value to be set- Returns:
- Builder
-
label
public FieldDefinitionBuilder label(Function<LocalizedStringBuilder, LocalizedStringBuilder> builder) A human-readable label for the field.
- Parameters:
builder
- function to build the label value- Returns:
- Builder
-
withLabel
A human-readable label for the field.
- Parameters:
builder
- function to build the label value- Returns:
- Builder
-
label
A human-readable label for the field.
- Parameters:
label
- value to be set- Returns:
- Builder
-
required
Defines whether the field is required to have a value.
- Parameters:
required
- value to be set- Returns:
- Builder
-
inputHint
Defines the visual representation of the field in user interfaces like the Merchant Center. It is only relevant for string-based FieldTypes like CustomFieldStringType and CustomFieldLocalizedStringType.
- Parameters:
inputHint
- value to be set- Returns:
- Builder
-
getType
Data type of the Custom Field to define.
- Returns:
- type
-
getName
Name of the Custom Field to define. Must be unique for a given ResourceTypeId. In case there is a FieldDefinition with the same
name
in another Type, both FieldDefinitions must have the sametype
.- Returns:
- name
-
getLabel
A human-readable label for the field.
- Returns:
- label
-
getRequired
Defines whether the field is required to have a value.
- Returns:
- required
-
getInputHint
Defines the visual representation of the field in user interfaces like the Merchant Center. It is only relevant for string-based FieldTypes like CustomFieldStringType and CustomFieldLocalizedStringType.
- Returns:
- inputHint
-
build
builds FieldDefinition with checking for non-null required values- Specified by:
build
in interfaceBuilder<FieldDefinition>
- Returns:
- FieldDefinition
-
buildUnchecked
builds FieldDefinition without checking for non-null required values- Returns:
- FieldDefinition
-
of
factory method for an instance of FieldDefinitionBuilder- Returns:
- builder
-
of
create builder for FieldDefinition instance- Parameters:
template
- instance with prefilled values for the builder- Returns:
- builder
-