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

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

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

import com.fasterxml.jackson.annotation.JsonCreator;
import io.sphere.sdk.channels.Channel;
import io.sphere.sdk.models.Base;
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 dsl class 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.ResourceDraftValueGenerator",
    comments = "Generated from: io.sphere.sdk.carts.LineItemDraft"
)
abstract class LineItemDraftDslBase extends Base implements LineItemDraft {
  @Nullable
  private ZonedDateTime addedAt;

  @Nullable
  private CustomFieldsDraft custom;

  @Nullable
  private ResourceIdentifier distributionChannel;

  @Nullable
  private MonetaryAmount externalPrice;

  @Nullable
  private ExternalTaxRateDraft externalTaxRate;

  @Nullable
  private ExternalLineItemTotalPrice externalTotalPrice;

  private String productId;

  @Nullable
  private Long quantity;

  @Nullable
  private ItemShippingDetailsDraft shippingDetails;

  private String sku;

  @Nullable
  private ResourceIdentifier supplyChannel;

  private Integer variantId;

  @JsonCreator
  LineItemDraftDslBase(@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;
  }

  @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 builder with the values of this object.
   *
   * @return new builder
   */
  public LineItemDraftBuilder newBuilder() {
    return new LineItemDraftBuilder(addedAt, custom, distributionChannel, externalPrice, externalTaxRate, externalTotalPrice, productId, quantity, shippingDetails, sku, supplyChannel, variantId);
  }

  @SuppressWarnings("unchecked")
  public T withAddedAt(@Nullable final ZonedDateTime addedAt) {
    return (T) newBuilder().addedAt(addedAt).build();
  }

  @SuppressWarnings("unchecked")
  public T withCustom(@Nullable final CustomFieldsDraft custom) {
    return (T) newBuilder().custom(custom).build();
  }

  @SuppressWarnings("unchecked")
  public T withDistributionChannel(
      @Nullable final ResourceIdentifier distributionChannel) {
    return (T) newBuilder().distributionChannel(distributionChannel).build();
  }

  @SuppressWarnings("unchecked")
  public T withExternalPrice(@Nullable final MonetaryAmount externalPrice) {
    return (T) newBuilder().externalPrice(externalPrice).build();
  }

  @SuppressWarnings("unchecked")
  public T withExternalTaxRate(@Nullable final ExternalTaxRateDraft externalTaxRate) {
    return (T) newBuilder().externalTaxRate(externalTaxRate).build();
  }

  @SuppressWarnings("unchecked")
  public T withExternalTotalPrice(@Nullable final ExternalLineItemTotalPrice externalTotalPrice) {
    return (T) newBuilder().externalTotalPrice(externalTotalPrice).build();
  }

  @SuppressWarnings("unchecked")
  public T withProductId(final String productId) {
    return (T) newBuilder().productId(productId).build();
  }

  @SuppressWarnings("unchecked")
  public T withQuantity(@Nullable final Long quantity) {
    return (T) newBuilder().quantity(quantity).build();
  }

  @SuppressWarnings("unchecked")
  public T withShippingDetails(@Nullable final ItemShippingDetailsDraft shippingDetails) {
    return (T) newBuilder().shippingDetails(shippingDetails).build();
  }

  @SuppressWarnings("unchecked")
  public T withSku(final String sku) {
    return (T) newBuilder().sku(sku).build();
  }

  @SuppressWarnings("unchecked")
  public T withSupplyChannel(@Nullable final ResourceIdentifier supplyChannel) {
    return (T) newBuilder().supplyChannel(supplyChannel).build();
  }

  @SuppressWarnings("unchecked")
  public T withVariantId(final Integer variantId) {
    return (T) newBuilder().variantId(variantId).build();
  }

  /**
   * 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 LineItemDraftDsl ofSku(final String sku, @Nullable final Long quantity) {
    return new LineItemDraftDsl(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 LineItemDraftDsl 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 LineItemDraftDsl(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 LineItemDraftDsl of(final LineItemDraft template) {
    return new LineItemDraftDsl(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