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)
.inputHint(TextInputHint.SINGLE_LINE)
.isSearchable(true)
.build()
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionattributeConstraint
(AttributeConstraintEnum attributeConstraint) Specifies how Attributes are validated across all variants of a Product.build()
builds AttributeDefinition with checking for non-null required valuesbuilds AttributeDefinition without checking for non-null required valuesSpecifies how Attributes are 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 Attribute information to aid content managers configure Product details.Iftrue
, the Attribute must have a value on a ProductVariant.Iftrue
, the Attribute's values are available for the Product Projections Search API for use 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 within 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 Attribute information to aid content managers configure Product details.Provides additional Attribute information to aid content managers configure Product details.isRequired
(Boolean isRequired) Iftrue
, the Attribute must have a value on a ProductVariant.isSearchable
(Boolean isSearchable) Iftrue
, the Attribute's values are available for the Product Projections Search API for use 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 within the Project.static AttributeDefinitionBuilder
of()
factory method for an instance of AttributeDefinitionBuilderstatic AttributeDefinitionBuilder
of
(AttributeDefinition template) create builder for AttributeDefinition instancetype
(AttributeType type) Describes the Type of the Attribute.type
(Function<AttributeTypeBuilder, Builder<? extends AttributeType>> builder) Describes the Type of the Attribute.Provides additional Attribute information to aid content managers configure Product details.Human-readable label for the Attribute.
-
Constructor Details
-
AttributeDefinitionBuilder
public AttributeDefinitionBuilder()
-
-
Method Details
-
type
Describes the Type of the Attribute.
- Parameters:
type
- value to be set- Returns:
- Builder
-
type
public AttributeDefinitionBuilder type(Function<AttributeTypeBuilder, Builder<? extends AttributeType>> builder) Describes the Type of the Attribute.
- Parameters:
builder
- function to build the type value- Returns:
- Builder
-
name
User-defined name of the Attribute that is unique within the Project.
- Parameters:
name
- value to be set- Returns:
- Builder
-
label
public AttributeDefinitionBuilder label(Function<LocalizedStringBuilder, LocalizedStringBuilder> builder) Human-readable label for the Attribute.
- Parameters:
builder
- function to build the label value- Returns:
- Builder
-
withLabel
public AttributeDefinitionBuilder 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
If
true
, the Attribute must have a value on a ProductVariant.- Parameters:
isRequired
- value to be set- Returns:
- Builder
-
attributeConstraint
Specifies how Attributes are validated across all variants of a Product.
- Parameters:
attributeConstraint
- value to be set- Returns:
- Builder
-
inputTip
public AttributeDefinitionBuilder inputTip(Function<LocalizedStringBuilder, LocalizedStringBuilder> builder) Provides additional Attribute information to aid content managers configure Product details.
- Parameters:
builder
- function to build the inputTip value- Returns:
- Builder
-
withInputTip
public AttributeDefinitionBuilder withInputTip(Function<LocalizedStringBuilder, LocalizedString> builder) Provides additional Attribute information to aid content managers configure Product details.
- Parameters:
builder
- function to build the inputTip value- Returns:
- Builder
-
inputTip
Provides additional Attribute information to aid content managers configure 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
If
true
, the Attribute's values are available for the Product Projections Search API for use 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.
- Returns:
- type
-
getName
User-defined name of the Attribute that is unique within the Project.
- Returns:
- name
-
getLabel
Human-readable label for the Attribute.
- Returns:
- label
-
getIsRequired
If
true
, the Attribute must have a value on a ProductVariant.- Returns:
- isRequired
-
getAttributeConstraint
Specifies how Attributes are validated across all variants of a Product.
- Returns:
- attributeConstraint
-
getInputTip
Provides additional Attribute information to aid content managers configure Product details.
- Returns:
- inputTip
-
getInputHint
Provides a visual representation directive for values of this Attribute (only relevant for AttributeTextType and AttributeLocalizableTextType).
- Returns:
- inputHint
-
getIsSearchable
If
true
, the Attribute's values are available for the Product Projections Search API for use 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 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
-