Class ProductSelectionBuilder

java.lang.Object
com.commercetools.api.models.product_selection.ProductSelectionBuilder
All Implemented Interfaces:
Builder<ProductSelection>

public class ProductSelectionBuilder extends Object implements Builder<ProductSelection>
ProductSelectionBuilder
Example to create an instance using the builder pattern

     ProductSelection productSelection = ProductSelection.builder()
             .id("{id}")
             .version(0.3)
             .createdAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
             .lastModifiedAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
             .name(nameBuilder -> nameBuilder)
             .productCount(0.3)
             .mode(ProductSelectionMode.INDIVIDUAL)
             .build()
 
  • Constructor Details

    • ProductSelectionBuilder

      public ProductSelectionBuilder()
  • Method Details

    • id

      Unique identifier of the ProductSelection.

      Parameters:
      id - value to be set
      Returns:
      Builder
    • version

      public ProductSelectionBuilder version(Long version)

      Current version of the ProductSelection.

      Parameters:
      version - value to be set
      Returns:
      Builder
    • createdAt

      public ProductSelectionBuilder createdAt(ZonedDateTime createdAt)

      Date and time (UTC) the ProductSelection was initially created.

      Parameters:
      createdAt - value to be set
      Returns:
      Builder
    • lastModifiedAt

      public ProductSelectionBuilder lastModifiedAt(ZonedDateTime lastModifiedAt)

      Date and time (UTC) the ProductSelection was last updated.

      Parameters:
      lastModifiedAt - value to be set
      Returns:
      Builder
    • lastModifiedBy

      Present on resources updated after 1/02/2019 except for events not tracked.

      Parameters:
      builder - function to build the lastModifiedBy value
      Returns:
      Builder
    • withLastModifiedBy

      Present on resources updated after 1/02/2019 except for events not tracked.

      Parameters:
      builder - function to build the lastModifiedBy value
      Returns:
      Builder
    • lastModifiedBy

      public ProductSelectionBuilder lastModifiedBy(@Nullable LastModifiedBy lastModifiedBy)

      Present on resources updated after 1/02/2019 except for events not tracked.

      Parameters:
      lastModifiedBy - value to be set
      Returns:
      Builder
    • createdBy

      Present on resources created after 1/02/2019 except for events not tracked.

      Parameters:
      builder - function to build the createdBy value
      Returns:
      Builder
    • withCreatedBy

      Present on resources created after 1/02/2019 except for events not tracked.

      Parameters:
      builder - function to build the createdBy value
      Returns:
      Builder
    • createdBy

      public ProductSelectionBuilder createdBy(@Nullable CreatedBy createdBy)

      Present on resources created after 1/02/2019 except for events not tracked.

      Parameters:
      createdBy - value to be set
      Returns:
      Builder
    • key

      User-defined unique identifier of the ProductSelection.

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

      Name of the ProductSelection.

      Parameters:
      builder - function to build the name value
      Returns:
      Builder
    • withName

      Name of the ProductSelection.

      Parameters:
      builder - function to build the name value
      Returns:
      Builder
    • name

      Name of the ProductSelection.

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

      public ProductSelectionBuilder productCount(Integer productCount)

      Number of Products that are currently assigned to this ProductSelection.

      Parameters:
      productCount - value to be set
      Returns:
      Builder
    • mode

      Specifies in which way the Products are assigned to the ProductSelection. Currently, the only way of doing this is to specify each Product individually, either by including or excluding them explicitly.

      Parameters:
      mode - value to be set
      Returns:
      Builder
    • custom

      Custom Fields of the ProductSelection.

      Parameters:
      builder - function to build the custom value
      Returns:
      Builder
    • withCustom

      Custom Fields of the ProductSelection.

      Parameters:
      builder - function to build the custom value
      Returns:
      Builder
    • custom

      Custom Fields of the ProductSelection.

      Parameters:
      custom - value to be set
      Returns:
      Builder
    • getId

      public String getId()

      Unique identifier of the ProductSelection.

      Returns:
      id
    • getVersion

      public Long getVersion()

      Current version of the ProductSelection.

      Returns:
      version
    • getCreatedAt

      public ZonedDateTime getCreatedAt()

      Date and time (UTC) the ProductSelection was initially created.

      Returns:
      createdAt
    • getLastModifiedAt

      public ZonedDateTime getLastModifiedAt()

      Date and time (UTC) the ProductSelection was last updated.

      Returns:
      lastModifiedAt
    • getLastModifiedBy

      @Nullable public LastModifiedBy getLastModifiedBy()

      Present on resources updated after 1/02/2019 except for events not tracked.

      Returns:
      lastModifiedBy
    • getCreatedBy

      @Nullable public CreatedBy getCreatedBy()

      Present on resources created after 1/02/2019 except for events not tracked.

      Returns:
      createdBy
    • getKey

      @Nullable public String getKey()

      User-defined unique identifier of the ProductSelection.

      Returns:
      key
    • getName

      public LocalizedString getName()

      Name of the ProductSelection.

      Returns:
      name
    • getProductCount

      public Integer getProductCount()

      Number of Products that are currently assigned to this ProductSelection.

      Returns:
      productCount
    • getMode

      public ProductSelectionMode getMode()

      Specifies in which way the Products are assigned to the ProductSelection. Currently, the only way of doing this is to specify each Product individually, either by including or excluding them explicitly.

      Returns:
      mode
    • getCustom

      @Nullable public CustomFields getCustom()

      Custom Fields of the ProductSelection.

      Returns:
      custom
    • build

      public ProductSelection build()
      builds ProductSelection with checking for non-null required values
      Specified by:
      build in interface Builder<ProductSelection>
      Returns:
      ProductSelection
    • buildUnchecked

      public ProductSelection buildUnchecked()
      builds ProductSelection without checking for non-null required values
      Returns:
      ProductSelection
    • of

      public static ProductSelectionBuilder of()
      factory method for an instance of ProductSelectionBuilder
      Returns:
      builder
    • of

      public static ProductSelectionBuilder of(ProductSelection template)
      create builder for ProductSelection instance
      Parameters:
      template - instance with prefilled values for the builder
      Returns:
      builder