Class AttributeDefinitionBuilder

java.lang.Object
com.commercetools.history.models.common.AttributeDefinitionBuilder
All Implemented Interfaces:
io.vrap.rmf.base.client.Builder<AttributeDefinition>

public class AttributeDefinitionBuilder extends Object implements io.vrap.rmf.base.client.Builder<AttributeDefinition>
AttributeDefinitionBuilder
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 Details

  • 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 same name 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 an enum or lenum type and sets thereof.

      Parameters:
      name - value to be set
      Returns:
      Builder
    • label

      set the value to the label using the builder function
      Parameters:
      builder - function to build the label value
      Returns:
      Builder
    • withLabel

      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

      set the value to the inputTip using the builder function
      Parameters:
      builder - function to build the inputTip value
      Returns:
      Builder
    • withInputTip

      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

      public String 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 same name 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 an enum or lenum 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 interface io.vrap.rmf.base.client.Builder<AttributeDefinition>
      Returns:
      AttributeDefinition
    • buildUnchecked

      builds AttributeDefinition without checking for non-null required values
      Returns:
      AttributeDefinition
    • of

      public static AttributeDefinitionBuilder 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