Class AttributeDefinitionBuilder
- All Implemented Interfaces:
Builder<AttributeDefinition>
Example to create an instance using the builder pattern
AttributeDefinition attributeDefinition = AttributeDefinition.builder()
.type(typeBuilder -> typeBuilder)
.name("{name}")
.label(labelBuilder -> labelBuilder)
.isRequired(true)
.attributeConstraint(AttributeConstraintEnum.NONE)
.inputTip(inputTipBuilder -> inputTipBuilder)
.inputHint(TextInputHint.SINGLE_LINE)
.isSearchable(true)
.build()
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionattributeConstraint
(AttributeConstraintEnum attributeConstraint) set the value to the attributeConstraintbuild()
builds AttributeDefinition with checking for non-null required valuesbuilds AttributeDefinition without checking for non-null required valuesvalue of attributeConstraint}value of inputHint}value of inputTip}Whether the attribute is required to have a value.Whether the attribute's values should generally be enabled in product search.getLabel()
value of label}getName()
The unique name of the attribute used in the API.getType()
value of type}inputHint
(TextInputHint inputHint) set the value to the inputHintinputTip
(LocalizedString inputTip) set the value to the inputTipset the value to the inputTip using the builder functionisRequired
(Boolean isRequired) Whether the attribute is required to have a value.isSearchable
(Boolean isSearchable) Whether the attribute's values should generally be enabled in product search.label
(LocalizedString label) set the value to the labelset the value to the label using the builder functionThe unique name of the attribute used in the API.static AttributeDefinitionBuilder
of()
factory method for an instance of AttributeDefinitionBuilderstatic AttributeDefinitionBuilder
of
(AttributeDefinition template) create builder for AttributeDefinition instancetype
(AttributeType type) set the value to the typetype
(Function<AttributeTypeBuilder, AttributeTypeBuilder> builder) set the value to the type using the builder functionset the value to the inputTip using the builder functionset the value to the label using the builder functionwithType
(Function<AttributeTypeBuilder, AttributeType> builder) set the value to the type using the builder function
-
Constructor Details
-
AttributeDefinitionBuilder
public AttributeDefinitionBuilder()
-
-
Method Details
-
type
set the value to the type using the builder function- Parameters:
builder
- function to build the type value- Returns:
- Builder
-
withType
set the value to the type using the builder function- Parameters:
builder
- function to build the type value- Returns:
- Builder
-
type
set the value to the type- Parameters:
type
- value to be set- Returns:
- Builder
-
name
The unique name of the attribute used in the API. The name must be between two and 256 characters long and can contain the ASCII letters A to Z in lowercase or uppercase, digits, underscores (
_
) and the hyphen-minus (-
). When using the samename
for an attribute in two or more product types all fields of the AttributeDefinition of this attribute need to be the same across the product types, otherwise an AttributeDefinitionAlreadyExists error code will be returned. An exception to this are the values of anenum
orlenum
type and sets thereof.- Parameters:
name
- value to be set- Returns:
- Builder
-
label
public AttributeDefinitionBuilder label(Function<LocalizedStringBuilder, LocalizedStringBuilder> builder) set the value to the label using the builder function- Parameters:
builder
- function to build the label value- Returns:
- Builder
-
withLabel
public AttributeDefinitionBuilder withLabel(Function<LocalizedStringBuilder, LocalizedString> builder) set the value to the label using the builder function- Parameters:
builder
- function to build the label value- Returns:
- Builder
-
label
set the value to the label- Parameters:
label
- value to be set- Returns:
- Builder
-
isRequired
Whether the attribute is required to have a value.
- Parameters:
isRequired
- value to be set- Returns:
- Builder
-
attributeConstraint
set the value to the attributeConstraint- Parameters:
attributeConstraint
- value to be set- Returns:
- Builder
-
inputTip
public AttributeDefinitionBuilder inputTip(Function<LocalizedStringBuilder, LocalizedStringBuilder> builder) set the value to the inputTip using the builder function- Parameters:
builder
- function to build the inputTip value- Returns:
- Builder
-
withInputTip
public AttributeDefinitionBuilder withInputTip(Function<LocalizedStringBuilder, LocalizedString> builder) set the value to the inputTip using the builder function- Parameters:
builder
- function to build the inputTip value- Returns:
- Builder
-
inputTip
set the value to the inputTip- Parameters:
inputTip
- value to be set- Returns:
- Builder
-
inputHint
set the value to the inputHint- Parameters:
inputHint
- value to be set- Returns:
- Builder
-
isSearchable
Whether the attribute's values should generally be enabled in product search. This determines whether the value is stored in products for matching terms in the context of full-text search queries and can be used in facets & filters as part of product search queries. The exact features that are enabled/disabled with this flag depend on the concrete attribute type and are described there. The max size of a searchable field is restricted to 10922 characters. This constraint is enforced at both product creation and product update. If the length of the input exceeds the maximum size an InvalidField error is returned.
- Parameters:
isSearchable
- value to be set- Returns:
- Builder
-
getType
value of type}- Returns:
- type
-
getName
The unique name of the attribute used in the API. The name must be between two and 256 characters long and can contain the ASCII letters A to Z in lowercase or uppercase, digits, underscores (
_
) and the hyphen-minus (-
). When using the samename
for an attribute in two or more product types all fields of the AttributeDefinition of this attribute need to be the same across the product types, otherwise an AttributeDefinitionAlreadyExists error code will be returned. An exception to this are the values of anenum
orlenum
type and sets thereof.- Returns:
- name
-
getLabel
value of label}- Returns:
- label
-
getIsRequired
Whether the attribute is required to have a value.
- Returns:
- isRequired
-
getAttributeConstraint
value of attributeConstraint}- Returns:
- attributeConstraint
-
getInputTip
value of inputTip}- Returns:
- inputTip
-
getInputHint
value of inputHint}- Returns:
- inputHint
-
getIsSearchable
Whether the attribute's values should generally be enabled in product search. This determines whether the value is stored in products for matching terms in the context of full-text search queries and can be used in facets & filters as part of product search queries. The exact features that are enabled/disabled with this flag depend on the concrete attribute type and are described there. The max size of a searchable field is restricted to 10922 characters. This constraint is enforced at both product creation and product update. If the length of the input exceeds the maximum size an InvalidField error is returned.
- Returns:
- isSearchable
-
build
builds AttributeDefinition with checking for non-null required values- Specified by:
build
in interfaceBuilder<AttributeDefinition>
- Returns:
- AttributeDefinition
-
buildUnchecked
builds AttributeDefinition without checking for non-null required values- Returns:
- AttributeDefinition
-
of
factory method for an instance of AttributeDefinitionBuilder- Returns:
- builder
-
of
create builder for AttributeDefinition instance- Parameters:
template
- instance with prefilled values for the builder- Returns:
- builder
-