All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.sphere.sdk.carts.LineItemDraftBuilderBase Maven / Gradle / Ivy

There is a newer version: 2.16.0
Show newest version
package io.sphere.sdk.carts;

import io.sphere.sdk.channels.Channel;
import io.sphere.sdk.models.Base;
import io.sphere.sdk.models.Builder;
import io.sphere.sdk.models.ResourceIdentifier;
import io.sphere.sdk.taxcategories.ExternalTaxRateDraft;
import io.sphere.sdk.types.CustomFieldsDraft;
import java.lang.Integer;
import java.lang.Long;
import java.lang.String;
import java.lang.SuppressWarnings;
import java.time.ZonedDateTime;
import javax.annotation.Generated;
import javax.annotation.Nullable;
import javax.money.MonetaryAmount;

/**
 * Abstract base builder for {@link LineItemDraft} which needs to be extended to add additional methods.
 * Subclasses have to provide the same non-default constructor as this class.
 */
@Generated(
    value = "io.sphere.sdk.annotations.processors.generators.DraftBuilderGenerator",
    comments = "Generated from: io.sphere.sdk.carts.LineItemDraft"
)
abstract class LineItemDraftBuilderBase extends Base implements Builder {
  @Nullable
  ZonedDateTime addedAt;

  @Nullable
  CustomFieldsDraft custom;

  @Nullable
  ResourceIdentifier distributionChannel;

  @Nullable
  MonetaryAmount externalPrice;

  @Nullable
  ExternalTaxRateDraft externalTaxRate;

  @Nullable
  ExternalLineItemTotalPrice externalTotalPrice;

  String productId;

  @Nullable
  Long quantity;

  @Nullable
  ItemShippingDetailsDraft shippingDetails;

  String sku;

  @Nullable
  ResourceIdentifier supplyChannel;

  Integer variantId;

  protected LineItemDraftBuilderBase() {
  }

  protected LineItemDraftBuilderBase(@Nullable final ZonedDateTime addedAt,
      @Nullable final CustomFieldsDraft custom,
      @Nullable final ResourceIdentifier distributionChannel,
      @Nullable final MonetaryAmount externalPrice,
      @Nullable final ExternalTaxRateDraft externalTaxRate,
      @Nullable final ExternalLineItemTotalPrice externalTotalPrice, final String productId,
      @Nullable final Long quantity, @Nullable final ItemShippingDetailsDraft shippingDetails,
      final String sku, @Nullable final ResourceIdentifier supplyChannel,
      final Integer variantId) {
    this.addedAt = addedAt;
    this.custom = custom;
    this.distributionChannel = distributionChannel;
    this.externalPrice = externalPrice;
    this.externalTaxRate = externalTaxRate;
    this.externalTotalPrice = externalTotalPrice;
    this.productId = productId;
    this.quantity = quantity;
    this.shippingDetails = shippingDetails;
    this.sku = sku;
    this.supplyChannel = supplyChannel;
    this.variantId = variantId;
  }

  /**
   * Sets the {@code addedAt} property of this builder.
   *
   * @param addedAt the value for {@link LineItemDraft#getAddedAt()}
   * @return this builder
   */
  @SuppressWarnings("unchecked")
  public T addedAt(@Nullable final ZonedDateTime addedAt) {
    this.addedAt = addedAt;
    return (T) this;
  }

  /**
   * Sets the {@code custom} property of this builder.
   *
   * @param custom the value for {@link LineItemDraft#getCustom()}
   * @return this builder
   */
  @SuppressWarnings("unchecked")
  public T custom(@Nullable final CustomFieldsDraft custom) {
    this.custom = custom;
    return (T) this;
  }

  /**
   * Sets the {@code distributionChannel} property of this builder.
   *
   * @param distributionChannel the value for {@link LineItemDraft#getDistributionChannel()}
   * @return this builder
   */
  @SuppressWarnings("unchecked")
  public T distributionChannel(@Nullable final ResourceIdentifier distributionChannel) {
    this.distributionChannel = distributionChannel;
    return (T) this;
  }

  /**
   * Sets the {@code externalPrice} property of this builder.
   *
   * @param externalPrice the value for {@link LineItemDraft#getExternalPrice()}
   * @return this builder
   */
  @SuppressWarnings("unchecked")
  public T externalPrice(@Nullable final MonetaryAmount externalPrice) {
    this.externalPrice = externalPrice;
    return (T) this;
  }

  /**
   * Sets the {@code externalTaxRate} property of this builder.
   *
   * @param externalTaxRate the value for {@link LineItemDraft#getExternalTaxRate()}
   * @return this builder
   */
  @SuppressWarnings("unchecked")
  public T externalTaxRate(@Nullable final ExternalTaxRateDraft externalTaxRate) {
    this.externalTaxRate = externalTaxRate;
    return (T) this;
  }

  /**
   * Sets the {@code externalTotalPrice} property of this builder.
   *
   * @param externalTotalPrice the value for {@link LineItemDraft#getExternalTotalPrice()}
   * @return this builder
   */
  @SuppressWarnings("unchecked")
  public T externalTotalPrice(@Nullable final ExternalLineItemTotalPrice externalTotalPrice) {
    this.externalTotalPrice = externalTotalPrice;
    return (T) this;
  }

  /**
   * Sets the {@code productId} property of this builder.
   *
   * @param productId the value for {@link LineItemDraft#getProductId()}
   * @return this builder
   */
  @SuppressWarnings("unchecked")
  public T productId(final String productId) {
    this.productId = productId;
    return (T) this;
  }

  /**
   * Sets the {@code quantity} property of this builder.
   *
   * @param quantity the value for {@link LineItemDraft#getQuantity()}
   * @return this builder
   */
  @SuppressWarnings("unchecked")
  public T quantity(@Nullable final Long quantity) {
    this.quantity = quantity;
    return (T) this;
  }

  /**
   * Sets the {@code shippingDetails} property of this builder.
   *
   * @param shippingDetails the value for {@link LineItemDraft#getShippingDetails()}
   * @return this builder
   */
  @SuppressWarnings("unchecked")
  public T shippingDetails(@Nullable final ItemShippingDetailsDraft shippingDetails) {
    this.shippingDetails = shippingDetails;
    return (T) this;
  }

  /**
   * Sets the {@code sku} property of this builder.
   *
   * @param sku the value for {@link LineItemDraft#getSku()}
   * @return this builder
   */
  @SuppressWarnings("unchecked")
  public T sku(final String sku) {
    this.sku = sku;
    return (T) this;
  }

  /**
   * Sets the {@code supplyChannel} property of this builder.
   *
   * @param supplyChannel the value for {@link LineItemDraft#getSupplyChannel()}
   * @return this builder
   */
  @SuppressWarnings("unchecked")
  public T supplyChannel(@Nullable final ResourceIdentifier supplyChannel) {
    this.supplyChannel = supplyChannel;
    return (T) this;
  }

  /**
   * Sets the {@code variantId} property of this builder.
   *
   * @param variantId the value for {@link LineItemDraft#getVariantId()}
   * @return this builder
   */
  @SuppressWarnings("unchecked")
  public T variantId(final Integer variantId) {
    this.variantId = variantId;
    return (T) this;
  }

  @Nullable
  public ZonedDateTime getAddedAt() {
    return addedAt;
  }

  @Nullable
  public CustomFieldsDraft getCustom() {
    return custom;
  }

  @Nullable
  public ResourceIdentifier getDistributionChannel() {
    return distributionChannel;
  }

  @Nullable
  public MonetaryAmount getExternalPrice() {
    return externalPrice;
  }

  @Nullable
  public ExternalTaxRateDraft getExternalTaxRate() {
    return externalTaxRate;
  }

  @Nullable
  public ExternalLineItemTotalPrice getExternalTotalPrice() {
    return externalTotalPrice;
  }

  public String getProductId() {
    return productId;
  }

  @Nullable
  public Long getQuantity() {
    return quantity;
  }

  @Nullable
  public ItemShippingDetailsDraft getShippingDetails() {
    return shippingDetails;
  }

  public String getSku() {
    return sku;
  }

  @Nullable
  public ResourceIdentifier getSupplyChannel() {
    return supplyChannel;
  }

  public Integer getVariantId() {
    return variantId;
  }

  /**
   * Creates a new instance of {@code LineItemDraftDsl} with the values of this builder.
   *
   * @return the instance
   */
  public LineItemDraftDsl build() {
    return new LineItemDraftDsl(addedAt, custom, distributionChannel, externalPrice, externalTaxRate, externalTotalPrice, productId, quantity, shippingDetails, sku, supplyChannel, variantId);
  }

  /**
   * Creates a new object initialized with the given values.
   *
   * @param sku initial value for the {@link LineItemDraft#getSku()} property
   * @param quantity initial value for the {@link LineItemDraft#getQuantity()} property
   * @return new object initialized with the given values
   */
  public static LineItemDraftBuilder ofSku(final String sku, @Nullable final Long quantity) {
    return new LineItemDraftBuilder(null, null, null, null, null, null, null, quantity, null, sku, null, null);
  }

  /**
   * Creates a new object initialized with the given values.
   *
   * @param productId initial value for the {@link LineItemDraft#getProductId()} property
   * @param variantId initial value for the {@link LineItemDraft#getVariantId()} property
   * @param quantity initial value for the {@link LineItemDraft#getQuantity()} property
   * @param supplyChannel initial value for the {@link LineItemDraft#getSupplyChannel()} property
   * @param distributionChannel initial value for the {@link LineItemDraft#getDistributionChannel()} property
   * @param custom initial value for the {@link LineItemDraft#getCustom()} property
   * @param externalTaxRate initial value for the {@link LineItemDraft#getExternalTaxRate()} property
   * @param externalPrice initial value for the {@link LineItemDraft#getExternalPrice()} property
   * @param externalTotalPrice initial value for the {@link LineItemDraft#getExternalTotalPrice()} property
   * @return new object initialized with the given values
   */
  public static LineItemDraftBuilder of(final String productId, final Integer variantId,
      @Nullable final Long quantity, @Nullable final ResourceIdentifier supplyChannel,
      @Nullable final ResourceIdentifier distributionChannel,
      @Nullable final CustomFieldsDraft custom,
      @Nullable final ExternalTaxRateDraft externalTaxRate,
      @Nullable final MonetaryAmount externalPrice,
      @Nullable final ExternalLineItemTotalPrice externalTotalPrice) {
    return new LineItemDraftBuilder(null, custom, distributionChannel, externalPrice, externalTaxRate, externalTotalPrice, productId, quantity, null, null, supplyChannel, variantId);
  }

  /**
   * Creates a new object initialized with the fields of the template parameter.
   *
   * @param template the template
   * @return a new object initialized from the template
   */
  public static LineItemDraftBuilder of(final LineItemDraft template) {
    return new LineItemDraftBuilder(template.getAddedAt(), template.getCustom(), template.getDistributionChannel(), template.getExternalPrice(), template.getExternalTaxRate(), template.getExternalTotalPrice(), template.getProductId(), template.getQuantity(), template.getShippingDetails(), template.getSku(), template.getSupplyChannel(), template.getVariantId());
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy