Interface VariantDraft

All Superinterfaces:
Draft<VariantDraft>

public interface VariantDraft extends Draft<VariantDraft>

Draft for creating a new Variant. When a Variant is created, only the current version is set. The staged version is only set when the Variant is updated with different current and staged data.


Example to create an instance using the builder pattern

     VariantDraft variantDraft = VariantDraft.builder()
             .product(productBuilder -> productBuilder)
             .build()
 
  • Method Details

    • getKey

      String getKey()

      User-defined unique identifier for the Variant. This field is optional, but we strongly recommend setting it.

      Returns:
      key
    • getSku

      String getSku()

      User-defined unique SKU of the Variant.

      Returns:
      sku
    • getProduct

      @NotNull @Valid @NotNull @Valid ProductResourceIdentifier getProduct()

      ResourceIdentifier of the Product the Variant belongs to.

      Returns:
      product
    • getPublish

      Boolean getPublish()

      Indicates whether the Variant is published. If true, the Variant will be immediately available in the current published state.

      Returns:
      publish
    • getImages

      @Valid @Valid List<Image> getImages()

      Images for the Variant.

      Returns:
      images
    • getAttributes

      @Valid @Valid List<Attribute> getAttributes()

      Variant Attributes according to the respective AttributeDefinition.

      Returns:
      attributes
    • getAssets

      @Valid @Valid List<AssetDraft> getAssets()

      Media assets for the Variant.

      Returns:
      assets
    • setKey

      void setKey(String key)

      User-defined unique identifier for the Variant. This field is optional, but we strongly recommend setting it.

      Parameters:
      key - value to be set
    • setSku

      void setSku(String sku)

      User-defined unique SKU of the Variant.

      Parameters:
      sku - value to be set
    • setProduct

      void setProduct(ProductResourceIdentifier product)

      ResourceIdentifier of the Product the Variant belongs to.

      Parameters:
      product - value to be set
    • setPublish

      void setPublish(Boolean publish)

      Indicates whether the Variant is published. If true, the Variant will be immediately available in the current published state.

      Parameters:
      publish - value to be set
    • setImages

      void setImages(Image... images)

      Images for the Variant.

      Parameters:
      images - values to be set
    • setImages

      void setImages(List<Image> images)

      Images for the Variant.

      Parameters:
      images - values to be set
    • setAttributes

      void setAttributes(Attribute... attributes)

      Variant Attributes according to the respective AttributeDefinition.

      Parameters:
      attributes - values to be set
    • setAttributes

      void setAttributes(List<Attribute> attributes)

      Variant Attributes according to the respective AttributeDefinition.

      Parameters:
      attributes - values to be set
    • setAssets

      void setAssets(AssetDraft... assets)

      Media assets for the Variant.

      Parameters:
      assets - values to be set
    • setAssets

      void setAssets(List<AssetDraft> assets)

      Media assets for the Variant.

      Parameters:
      assets - values to be set
    • of

      static VariantDraft of()
      factory method
      Returns:
      instance of VariantDraft
    • of

      static VariantDraft of(VariantDraft template)
      factory method to create a shallow copy VariantDraft
      Parameters:
      template - instance to be copied
      Returns:
      copy instance
    • copyDeep

      VariantDraft copyDeep()
    • deepCopy

      @Nullable static VariantDraft deepCopy(@Nullable VariantDraft template)
      factory method to create a deep copy of VariantDraft
      Parameters:
      template - instance to be copied
      Returns:
      copy instance
    • builder

      static VariantDraftBuilder builder()
      builder factory method for VariantDraft
      Returns:
      builder
    • builder

      static VariantDraftBuilder builder(VariantDraft template)
      create builder for VariantDraft instance
      Parameters:
      template - instance with prefilled values for the builder
      Returns:
      builder
    • withVariantDraft

      default <T> T withVariantDraft(Function<VariantDraft,T> helper)
      accessor map function
      Type Parameters:
      T - mapped type
      Parameters:
      helper - function to map the object
      Returns:
      mapped value
    • typeReference

      static tools.jackson.core.type.TypeReference<VariantDraft> typeReference()
      gives a TypeReference for usage with Jackson DataBind
      Returns:
      TypeReference