Interface Variant

All Superinterfaces:
BaseResource

public interface Variant extends BaseResource

A Variant represents a single Variant with both current (published) and staged (draft) data. Variants are writable resources that support create, update, and delete operations.


Example to create an instance using the builder pattern

     Variant variant = Variant.builder()
             .id("{id}")
             .version(0.3)
             .createdAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
             .lastModifiedAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
             .variantId(0.3)
             .product(productBuilder -> productBuilder)
             .published(true)
             .current(currentBuilder -> currentBuilder)
             .build()
 
  • Method Details

    • getId

      @NotNull @NotNull String getId()

      Unique identifier of the Variant.

      Specified by:
      getId in interface BaseResource
      Returns:
      id
    • getVersion

      @NotNull @NotNull Long getVersion()

      Current version of the Variant.

      Specified by:
      getVersion in interface BaseResource
      Returns:
      version
    • getCreatedAt

      @NotNull @NotNull ZonedDateTime getCreatedAt()

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

      Specified by:
      getCreatedAt in interface BaseResource
      Returns:
      createdAt
    • getLastModifiedAt

      @NotNull @NotNull ZonedDateTime getLastModifiedAt()

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

      Specified by:
      getLastModifiedAt in interface BaseResource
      Returns:
      lastModifiedAt
    • getLastModifiedBy

      @Valid @Valid LastModifiedBy getLastModifiedBy()

      IDs and references that last modified the Variant.

      Returns:
      lastModifiedBy
    • getCreatedBy

      @Valid @Valid CreatedBy getCreatedBy()

      IDs and references that created the Variant.

      Returns:
      createdBy
    • getKey

      String getKey()

      User-defined unique identifier of the Variant. This is different from Product key.

      Returns:
      key
    • getVariantId

      @NotNull @NotNull Integer getVariantId()

      A unique, sequential identifier of the Variant within the parent Product.

      Returns:
      variantId
    • getProduct

      @NotNull @Valid @NotNull @Valid ProductReference getProduct()

      Reference to the parent Product the Variant belongs to.

      Returns:
      product
    • getPublished

      @NotNull @NotNull Boolean getPublished()

      true if the Variant is published, false if it is unpublished.

      Returns:
      published
    • getCurrent

      @NotNull @Valid @NotNull @Valid VariantData getCurrent()

      The current data of the Variant.

      Returns:
      current
    • getStaged

      @Valid @Valid VariantData getStaged()

      The staged data of the Variant. Only present if there are staged changes that differ from the current data.

      Returns:
      staged
    • setId

      void setId(String id)

      Unique identifier of the Variant.

      Specified by:
      setId in interface BaseResource
      Parameters:
      id - value to be set
    • setVersion

      void setVersion(Long version)

      Current version of the Variant.

      Specified by:
      setVersion in interface BaseResource
      Parameters:
      version - value to be set
    • setCreatedAt

      void setCreatedAt(ZonedDateTime createdAt)

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

      Specified by:
      setCreatedAt in interface BaseResource
      Parameters:
      createdAt - value to be set
    • setLastModifiedAt

      void setLastModifiedAt(ZonedDateTime lastModifiedAt)

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

      Specified by:
      setLastModifiedAt in interface BaseResource
      Parameters:
      lastModifiedAt - value to be set
    • setLastModifiedBy

      void setLastModifiedBy(LastModifiedBy lastModifiedBy)

      IDs and references that last modified the Variant.

      Parameters:
      lastModifiedBy - value to be set
    • setCreatedBy

      void setCreatedBy(CreatedBy createdBy)

      IDs and references that created the Variant.

      Parameters:
      createdBy - value to be set
    • setKey

      void setKey(String key)

      User-defined unique identifier of the Variant. This is different from Product key.

      Parameters:
      key - value to be set
    • setVariantId

      void setVariantId(Integer variantId)

      A unique, sequential identifier of the Variant within the parent Product.

      Parameters:
      variantId - value to be set
    • setProduct

      void setProduct(ProductReference product)

      Reference to the parent Product the Variant belongs to.

      Parameters:
      product - value to be set
    • setPublished

      void setPublished(Boolean published)

      true if the Variant is published, false if it is unpublished.

      Parameters:
      published - value to be set
    • setCurrent

      void setCurrent(VariantData current)

      The current data of the Variant.

      Parameters:
      current - value to be set
    • setStaged

      void setStaged(VariantData staged)

      The staged data of the Variant. Only present if there are staged changes that differ from the current data.

      Parameters:
      staged - value to be set
    • of

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

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

      Variant copyDeep()
      Specified by:
      copyDeep in interface BaseResource
    • deepCopy

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

      static VariantBuilder builder()
      builder factory method for Variant
      Returns:
      builder
    • builder

      static VariantBuilder builder(Variant template)
      create builder for Variant instance
      Parameters:
      template - instance with prefilled values for the builder
      Returns:
      builder
    • withVariant

      default <T> T withVariant(Function<Variant,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<Variant> typeReference()
      gives a TypeReference for usage with Jackson DataBind
      Returns:
      TypeReference