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)

      Maps to ProductVariant.isMasterVariant.

      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
    • publish

      public ProductVariantImportBuilder publish(@Nullable Boolean publish)

      If publish is set to either true or false, both staged and current projections are set to the same value provided by the import data. If publish is not set, the staged projection is set to the provided import data, but the current projection stays unchanged. However, if the import data contains no update, that is, if it matches the staged projection of the existing Product, the import induces no change in the existing Product whether publish is set or not.

      Parameters:
      publish - 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()

      Maps to ProductVariant.isMasterVariant.

      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
    • getPublish

      @Nullable public Boolean getPublish()

      If publish is set to either true or false, both staged and current projections are set to the same value provided by the import data. If publish is not set, the staged projection is set to the provided import data, but the current projection stays unchanged. However, if the import data contains no update, that is, if it matches the staged projection of the existing Product, the import induces no change in the existing Product whether publish is set or not.

      Returns:
      publish
    • 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