Class AttributeDefinitionDraftBuilder
- All Implemented Interfaces:
Builder<AttributeDefinitionDraft>
Example to create an instance using the builder pattern
AttributeDefinitionDraft attributeDefinitionDraft = AttributeDefinitionDraft.builder()
.type(typeBuilder -> typeBuilder)
.name("{name}")
.label(labelBuilder -> labelBuilder)
.isRequired(true)
.build()
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionattributeConstraint
(AttributeConstraintEnum attributeConstraint) Specifies how an Attribute or a combination of Attributes should be validated across all variants of a Product.build()
builds AttributeDefinitionDraft with checking for non-null required valuesbuilds AttributeDefinitionDraft without checking for non-null required valuesSpecifies how an Attribute or a combination of Attributes should be validated across all variants of a Product.Provides a visual representation directive for values of this Attribute (only relevant for AttributeTextType and AttributeLocalizableTextType).Provides additional information about the Attribute that aids content managers when setting Product details.Set totrue
if the Attribute is required to have a value on a ProductVariant.Set totrue
if the Attribute's values should be available in the Product Projections Search API and can be used in full-text search queries, filters, and facets.getLabel()
Human-readable label for the Attribute.getName()
User-defined name of the Attribute that is unique with the Project.getType()
Describes the Type of the Attribute.inputHint
(TextInputHint inputHint) Provides a visual representation directive for values of this Attribute (only relevant for AttributeTextType and AttributeLocalizableTextType).inputTip
(LocalizedString inputTip) Provides additional information about the Attribute that aids content managers when setting Product details.Provides additional information about the Attribute that aids content managers when setting Product details.isRequired
(Boolean isRequired) Set totrue
if the Attribute is required to have a value on a ProductVariant.isSearchable
(Boolean isSearchable) Set totrue
if the Attribute's values should be available in the Product Projections Search API and can be used in full-text search queries, filters, and facets.label
(LocalizedString label) Human-readable label for the Attribute.Human-readable label for the Attribute.User-defined name of the Attribute that is unique with the Project.of()
factory method for an instance of AttributeDefinitionDraftBuilderof
(AttributeDefinitionDraft template) create builder for AttributeDefinitionDraft instancetype
(AttributeType type) Describes the Type of the Attribute.type
(Function<AttributeTypeBuilder, Builder<? extends AttributeType>> builder) Describes the Type of the Attribute.Provides additional information about the Attribute that aids content managers when setting Product details.Human-readable label for the Attribute.
-
Constructor Details
-
AttributeDefinitionDraftBuilder
public AttributeDefinitionDraftBuilder()
-
-
Method Details
-
type
Describes the Type of the Attribute.
When the
type
is different for an AttributeDefinition using the same name in multiple ProductTypes, an AttributeDefinitionTypeConflict error is returned.- Parameters:
type
- value to be set- Returns:
- Builder
-
type
public AttributeDefinitionDraftBuilder type(Function<AttributeTypeBuilder, Builder<? extends AttributeType>> builder) Describes the Type of the Attribute.
When the
type
is different for an AttributeDefinition using the same name in multiple ProductTypes, an AttributeDefinitionTypeConflict error is returned.- Parameters:
builder
- function to build the type value- Returns:
- Builder
-
name
User-defined name of the Attribute that is unique with the Project.
When using the same
name
for an Attribute in multiple ProductTypes, all fields of the AttributeDefinition of this Attribute must be the same across the ProductTypes, else an AttributeDefinitionAlreadyExists error is 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 AttributeDefinitionDraftBuilder label(Function<LocalizedStringBuilder, LocalizedStringBuilder> builder) Human-readable label for the Attribute.
- Parameters:
builder
- function to build the label value- Returns:
- Builder
-
withLabel
public AttributeDefinitionDraftBuilder withLabel(Function<LocalizedStringBuilder, LocalizedString> builder) Human-readable label for the Attribute.
- Parameters:
builder
- function to build the label value- Returns:
- Builder
-
label
Human-readable label for the Attribute.
- Parameters:
label
- value to be set- Returns:
- Builder
-
isRequired
Set to
true
if the Attribute is required to have a value on a ProductVariant.- Parameters:
isRequired
- value to be set- Returns:
- Builder
-
attributeConstraint
public AttributeDefinitionDraftBuilder attributeConstraint(@Nullable AttributeConstraintEnum attributeConstraint) Specifies how an Attribute or a combination of Attributes should be validated across all variants of a Product.
- Parameters:
attributeConstraint
- value to be set- Returns:
- Builder
-
inputTip
public AttributeDefinitionDraftBuilder inputTip(Function<LocalizedStringBuilder, LocalizedStringBuilder> builder) Provides additional information about the Attribute that aids content managers when setting Product details.
- Parameters:
builder
- function to build the inputTip value- Returns:
- Builder
-
withInputTip
public AttributeDefinitionDraftBuilder withInputTip(Function<LocalizedStringBuilder, LocalizedString> builder) Provides additional information about the Attribute that aids content managers when setting Product details.
- Parameters:
builder
- function to build the inputTip value- Returns:
- Builder
-
inputTip
Provides additional information about the Attribute that aids content managers when setting Product details.
- Parameters:
inputTip
- value to be set- Returns:
- Builder
-
inputHint
Provides a visual representation directive for values of this Attribute (only relevant for AttributeTextType and AttributeLocalizableTextType).
- Parameters:
inputHint
- value to be set- Returns:
- Builder
-
isSearchable
Set to
true
if the Attribute's values should be available in the Product Projections Search API and can be used in full-text search queries, filters, and facets. Which exact features are available with this flag depends on the specific AttributeType. The maximum size of a searchable field is restricted by the Field content size limit. 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
Describes the Type of the Attribute.
When the
type
is different for an AttributeDefinition using the same name in multiple ProductTypes, an AttributeDefinitionTypeConflict error is returned.- Returns:
- type
-
getName
User-defined name of the Attribute that is unique with the Project.
When using the same
name
for an Attribute in multiple ProductTypes, all fields of the AttributeDefinition of this Attribute must be the same across the ProductTypes, else an AttributeDefinitionAlreadyExists error is returned. An exception to this are the values of anenum
orlenum
Type and sets thereof.- Returns:
- name
-
getLabel
Human-readable label for the Attribute.
- Returns:
- label
-
getIsRequired
Set to
true
if the Attribute is required to have a value on a ProductVariant.- Returns:
- isRequired
-
getAttributeConstraint
Specifies how an Attribute or a combination of Attributes should be validated across all variants of a Product.
- Returns:
- attributeConstraint
-
getInputTip
Provides additional information about the Attribute that aids content managers when setting Product details.
- Returns:
- inputTip
-
getInputHint
Provides a visual representation directive for values of this Attribute (only relevant for AttributeTextType and AttributeLocalizableTextType).
- Returns:
- inputHint
-
getIsSearchable
Set to
true
if the Attribute's values should be available in the Product Projections Search API and can be used in full-text search queries, filters, and facets. Which exact features are available with this flag depends on the specific AttributeType. The maximum size of a searchable field is restricted by the Field content size limit. 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 AttributeDefinitionDraft with checking for non-null required values- Specified by:
build
in interfaceBuilder<AttributeDefinitionDraft>
- Returns:
- AttributeDefinitionDraft
-
buildUnchecked
builds AttributeDefinitionDraft without checking for non-null required values- Returns:
- AttributeDefinitionDraft
-
of
factory method for an instance of AttributeDefinitionDraftBuilder- Returns:
- builder
-
of
create builder for AttributeDefinitionDraft instance- Parameters:
template
- instance with prefilled values for the builder- Returns:
- builder
-