Interface FieldDefinition
Defines a Custom Field and its meta-information. This FieldDefinition is similar to an AttributeDefinition of Product Types.
Example to create an instance using the builder pattern
FieldDefinition fieldDefinition = FieldDefinition.builder()
.type(typeBuilder -> typeBuilder)
.name("{name}")
.label(labelBuilder -> labelBuilder)
.required(true)
.build()
-
Method Summary
Modifier and TypeMethodDescriptionstatic FieldDefinitionBuilder
builder()
builder factory method for FieldDefinitionstatic FieldDefinitionBuilder
builder
(FieldDefinition template) create builder for FieldDefinition instancestatic FieldDefinition
deepCopy
(FieldDefinition template) factory method to create a deep copy of FieldDefinitionDefines the visual representation of the field in user interfaces like the Merchant Center.@NotNull @Valid LocalizedString
getLabel()
A human-readable label for the field.@NotNull String
getName()
Name of the Custom Field to define.@NotNull Boolean
Defines whether the field is required to have a value.@NotNull @Valid FieldType
getType()
Data type of the Custom Field to define.static FieldDefinition
of()
factory methodstatic FieldDefinition
of
(FieldDefinition template) factory method to create a shallow copy FieldDefinitionvoid
setInputHint
(TypeTextInputHint inputHint) Defines the visual representation of the field in user interfaces like the Merchant Center.void
setLabel
(LocalizedString label) A human-readable label for the field.void
Name of the Custom Field to define.void
setRequired
(Boolean required) Defines whether the field is required to have a value.void
Data type of the Custom Field to define.static com.fasterxml.jackson.core.type.TypeReference<FieldDefinition>
gives a TypeReference for usage with Jackson DataBinddefault <T> T
withFieldDefinition
(Function<FieldDefinition, T> helper) accessor map function
-
Method Details
-
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
TypeTextInputHint 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
-
setType
Data type of the Custom Field to define.
- Parameters:
type
- value to be set
-
setName
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
-
setLabel
A human-readable label for the field.
- Parameters:
label
- value to be set
-
setRequired
Defines whether the field is required to have a value.
- Parameters:
required
- value to be set
-
setInputHint
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
-
of
factory method- Returns:
- instance of FieldDefinition
-
of
factory method to create a shallow copy FieldDefinition- Parameters:
template
- instance to be copied- Returns:
- copy instance
-
deepCopy
factory method to create a deep copy of FieldDefinition- Parameters:
template
- instance to be copied- Returns:
- copy instance
-
builder
builder factory method for FieldDefinition- Returns:
- builder
-
builder
create builder for FieldDefinition instance- Parameters:
template
- instance with prefilled values for the builder- Returns:
- builder
-
withFieldDefinition
accessor map function- Type Parameters:
T
- mapped type- Parameters:
helper
- function to map the object- Returns:
- mapped value
-
typeReference
gives a TypeReference for usage with Jackson DataBind- Returns:
- TypeReference
-