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 FieldDefinitionBuilderbuilder()builder factory method for FieldDefinitionstatic FieldDefinitionBuilderbuilder(FieldDefinition template) create builder for FieldDefinition instancecopyDeep()static FieldDefinitiondeepCopy(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 LocalizedStringgetLabel()A human-readable label for the field.@NotNull StringgetName()Name of the Custom Field to define.@NotNull BooleanDefines whether the field is required to have a value.@NotNull @Valid FieldTypegetType()Data type of the Custom Field to define.static FieldDefinitionof()factory methodstatic FieldDefinitionof(FieldDefinition template) factory method to create a shallow copy FieldDefinitionvoidsetInputHint(TypeTextInputHint inputHint) Defines the visual representation of the field in user interfaces like the Merchant Center.voidsetLabel(LocalizedString label) A human-readable label for the field.voidName of the Custom Field to define.voidsetRequired(Boolean required) Defines whether the field is required to have a value.voidData type of the Custom Field to define.static com.fasterxml.jackson.core.type.TypeReference<FieldDefinition>gives a TypeReference for usage with Jackson DataBinddefault <T> TwithFieldDefinition(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
namein 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
namein 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
-
copyDeep
FieldDefinition copyDeep() -
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
-