Class ProductVariantImportBuilder

java.lang.Object
com.commercetools.importapi.models.productvariants.ProductVariantImportBuilder
All Implemented Interfaces:
Builder<ProductVariantImport>

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

     ProductVariantImport productVariantImport = ProductVariantImport.builder()
             .key("{key}")
             .isMasterVariant(true)
             .product(productBuilder -> productBuilder)
             .build()
 
  • Constructor Details

    • ProductVariantImportBuilder

      public ProductVariantImportBuilder()
  • Method Details

    • key

      User-defined unique identifier. If a ProductVariant with this key exists on the specified product, it will be updated with the imported data.

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

      Maps to ProductVariant.sku.

      Parameters:
      sku - value to be set
      Returns:
      Builder
    • isMasterVariant

      public ProductVariantImportBuilder isMasterVariant(Boolean isMasterVariant)
      • When creating a new ProductVariant, set to false; otherwise, the import operation will fail with a NewMasterVariantAdditionNotAllowed error.
      • Set to true if the ProductVariant exists and you want to set this ProductVariant as the Master Variant.
      Parameters:
      isMasterVariant - value to be set
      Returns:
      Builder
    • attributes

      public ProductVariantImportBuilder attributes(@Nullable Attribute... attributes)

      Maps to ProductVariant.attributes. The referenced attribute must be defined in an already existing ProductType in the project, or the state of the ImportOperation will be unresolved.

      Parameters:
      attributes - value to be set
      Returns:
      Builder
    • attributes

      public ProductVariantImportBuilder attributes(@Nullable List<Attribute> attributes)

      Maps to ProductVariant.attributes. The referenced attribute must be defined in an already existing ProductType in the project, or the state of the ImportOperation will be unresolved.

      Parameters:
      attributes - value to be set
      Returns:
      Builder
    • plusAttributes

      public ProductVariantImportBuilder plusAttributes(@Nullable Attribute... attributes)

      Maps to ProductVariant.attributes. The referenced attribute must be defined in an already existing ProductType in the project, or the state of the ImportOperation will be unresolved.

      Parameters:
      attributes - value to be set
      Returns:
      Builder
    • plusAttributes

      public ProductVariantImportBuilder plusAttributes(Function<AttributeBuilder,Builder<? extends Attribute>> builder)

      Maps to ProductVariant.attributes. The referenced attribute must be defined in an already existing ProductType in the project, or the state of the ImportOperation will be unresolved.

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

      public ProductVariantImportBuilder withAttributes(Function<AttributeBuilder,Builder<? extends Attribute>> builder)

      Maps to ProductVariant.attributes. The referenced attribute must be defined in an already existing ProductType in the project, or the state of the ImportOperation will be unresolved.

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

      public ProductVariantImportBuilder images(@Nullable Image... images)

      Maps to ProductVariant.images.

      Parameters:
      images - value to be set
      Returns:
      Builder
    • images

      Maps to ProductVariant.images.

      Parameters:
      images - value to be set
      Returns:
      Builder
    • plusImages

      public ProductVariantImportBuilder plusImages(@Nullable Image... images)

      Maps to ProductVariant.images.

      Parameters:
      images - value to be set
      Returns:
      Builder
    • plusImages

      Maps to ProductVariant.images.

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

      Maps to ProductVariant.images.

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

      Maps to ProductVariant.images.

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

      Maps to ProductVariant.images.

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

      public ProductVariantImportBuilder assets(@Nullable Asset... assets)

      Maps to ProductVariant.assets.

      Parameters:
      assets - value to be set
      Returns:
      Builder
    • assets

      Maps to ProductVariant.assets.

      Parameters:
      assets - value to be set
      Returns:
      Builder
    • plusAssets

      public ProductVariantImportBuilder plusAssets(@Nullable Asset... assets)

      Maps to ProductVariant.assets.

      Parameters:
      assets - value to be set
      Returns:
      Builder
    • plusAssets

      Maps to ProductVariant.assets.

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

      Maps to ProductVariant.assets.

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

      Maps to ProductVariant.assets.

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

      Maps to ProductVariant.assets.

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

      • Set to false to update both the current and staged projections of the Product with the new Product Variant data.
      • Leave empty or set to true to only update the staged projection.
      Parameters:
      staged - value to be set
      Returns:
      Builder
    • product

      The Product to which this Product Variant belongs. Maps to ProductVariant.product. The Reference to the Product with which the ProductVariant is associated. If referenced Product does not exist, the state of the ImportOperation will be set to unresolved until the necessary Product is created.

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

      The Product to which this Product Variant belongs. Maps to ProductVariant.product. The Reference to the Product with which the ProductVariant is associated. If referenced Product does not exist, the state of the ImportOperation will be set to unresolved until the necessary Product is created.

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

      The Product to which this Product Variant belongs. Maps to ProductVariant.product. The Reference to the Product with which the ProductVariant is associated. If referenced Product does not exist, the state of the ImportOperation will be set to unresolved until the necessary Product is created.

      Parameters:
      product - value to be set
      Returns:
      Builder
    • getKey

      public String getKey()

      User-defined unique identifier. If a ProductVariant with this key exists on the specified product, it will be updated with the imported data.

      Returns:
      key
    • getSku

      @Nullable public String getSku()

      Maps to ProductVariant.sku.

      Returns:
      sku
    • getIsMasterVariant

      public Boolean getIsMasterVariant()
      • When creating a new ProductVariant, set to false; otherwise, the import operation will fail with a NewMasterVariantAdditionNotAllowed error.
      • Set to true if the ProductVariant exists and you want to set this ProductVariant as the Master Variant.
      Returns:
      isMasterVariant
    • getAttributes

      @Nullable public List<Attribute> getAttributes()

      Maps to ProductVariant.attributes. The referenced attribute must be defined in an already existing ProductType in the project, or the state of the ImportOperation will be unresolved.

      Returns:
      attributes
    • getImages

      @Nullable public List<Image> getImages()

      Maps to ProductVariant.images.

      Returns:
      images
    • getAssets

      @Nullable public List<Asset> getAssets()

      Maps to ProductVariant.assets.

      Returns:
      assets
    • getStaged

      @Nullable public Boolean getStaged()
      • Set to false to update both the current and staged projections of the Product with the new Product Variant data.
      • Leave empty or set to true to only update the staged projection.
      Returns:
      staged
    • getProduct

      public ProductKeyReference getProduct()

      The Product to which this Product Variant belongs. Maps to ProductVariant.product. The Reference to the Product with which the ProductVariant is associated. If referenced Product does not exist, the state of the ImportOperation will be set to unresolved until the necessary Product is created.

      Returns:
      product
    • build

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

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

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

      create builder for ProductVariantImport instance
      Parameters:
      template - instance with prefilled values for the builder
      Returns:
      builder