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

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

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

import com.neovisionaries.i18n.CountryCode;
import io.sphere.sdk.customergroups.CustomerGroup;
import io.sphere.sdk.models.Address;
import io.sphere.sdk.models.Base;
import io.sphere.sdk.models.Builder;
import io.sphere.sdk.models.Reference;
import io.sphere.sdk.models.Referenceable;
import io.sphere.sdk.shippingmethods.ShippingMethod;
import io.sphere.sdk.types.CustomFieldsDraft;
import io.sphere.sdk.utils.SphereInternalUtils;
import java.lang.Integer;
import java.lang.String;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.Optional;
import javax.annotation.Generated;
import javax.annotation.Nullable;
import javax.money.CurrencyUnit;

/**
 * Builder for {@link CartDraft}.
 */
@Generated(
    value = "io.sphere.sdk.annotations.processors.generators.DraftBuilderGenerator",
    comments = "Generated from: io.sphere.sdk.carts.CartDraft"
)
public final class CartDraftBuilder extends Base implements Builder {
  @Nullable
  private String anonymousId;

  @Nullable
  private Address billingAddress;

  @Nullable
  private CountryCode country;

  private CurrencyUnit currency;

  @Nullable
  private CustomFieldsDraft custom;

  @Nullable
  private List customLineItems;

  @Nullable
  private String customerEmail;

  @Nullable
  private Reference customerGroup;

  @Nullable
  private String customerId;

  @Nullable
  private Integer deleteDaysAfterLastModification;

  @Nullable
  private InventoryMode inventoryMode;

  @Nullable
  private List
itemShippingAddresses; @Nullable private List lineItems; @Nullable private Locale locale; @Nullable private CartOrigin origin; @Nullable private Address shippingAddress; @Nullable private Reference shippingMethod; @Nullable private ShippingRateInputDraft shippingRateInput; @Nullable private TaxCalculationMode taxCalculationMode; @Nullable private TaxMode taxMode; @Nullable private RoundingMode taxRoundingMode; CartDraftBuilder() { } CartDraftBuilder(@Nullable final String anonymousId, @Nullable final Address billingAddress, @Nullable final CountryCode country, final CurrencyUnit currency, @Nullable final CustomFieldsDraft custom, @Nullable final List customLineItems, @Nullable final String customerEmail, @Nullable final Reference customerGroup, @Nullable final String customerId, @Nullable final Integer deleteDaysAfterLastModification, @Nullable final InventoryMode inventoryMode, @Nullable final List
itemShippingAddresses, @Nullable final List lineItems, @Nullable final Locale locale, @Nullable final CartOrigin origin, @Nullable final Address shippingAddress, @Nullable final Reference shippingMethod, @Nullable final ShippingRateInputDraft shippingRateInput, @Nullable final TaxCalculationMode taxCalculationMode, @Nullable final TaxMode taxMode, @Nullable final RoundingMode taxRoundingMode) { this.anonymousId = anonymousId; this.billingAddress = billingAddress; this.country = country; this.currency = currency; this.custom = custom; this.customLineItems = customLineItems; this.customerEmail = customerEmail; this.customerGroup = customerGroup; this.customerId = customerId; this.deleteDaysAfterLastModification = deleteDaysAfterLastModification; this.inventoryMode = inventoryMode; this.itemShippingAddresses = itemShippingAddresses; this.lineItems = lineItems; this.locale = locale; this.origin = origin; this.shippingAddress = shippingAddress; this.shippingMethod = shippingMethod; this.shippingRateInput = shippingRateInput; this.taxCalculationMode = taxCalculationMode; this.taxMode = taxMode; this.taxRoundingMode = taxRoundingMode; } /** * Sets the {@code anonymousId} property of this builder. * * @param anonymousId the value for {@link CartDraft#getAnonymousId()} * @return this builder */ public CartDraftBuilder anonymousId(@Nullable final String anonymousId) { this.anonymousId = anonymousId; return this; } /** * Sets the {@code billingAddress} property of this builder. * * @param billingAddress the value for {@link CartDraft#getBillingAddress()} * @return this builder */ public CartDraftBuilder billingAddress(@Nullable final Address billingAddress) { this.billingAddress = billingAddress; return this; } /** * Sets the {@code country} property of this builder. * * @param country the value for {@link CartDraft#getCountry()} * @return this builder */ public CartDraftBuilder country(@Nullable final CountryCode country) { this.country = country; return this; } /** * Sets the {@code currency} property of this builder. * * @param currency the value for {@link CartDraft#getCurrency()} * @return this builder */ public CartDraftBuilder currency(final CurrencyUnit currency) { this.currency = currency; return this; } /** * Sets the {@code custom} property of this builder. * * @param custom the value for {@link CartDraft#getCustom()} * @return this builder */ public CartDraftBuilder custom(@Nullable final CustomFieldsDraft custom) { this.custom = custom; return this; } /** * Sets the {@code customLineItems} property of this builder. * * @param customLineItems the value for {@link CartDraft#getCustomLineItems()} * @return this builder */ public CartDraftBuilder customLineItems(@Nullable final List customLineItems) { this.customLineItems = customLineItems; return this; } /** * Sets the {@code customerEmail} property of this builder. * * @param customerEmail the value for {@link CartDraft#getCustomerEmail()} * @return this builder */ public CartDraftBuilder customerEmail(@Nullable final String customerEmail) { this.customerEmail = customerEmail; return this; } /** * Sets the {@code customerGroup} property of this builder. * * @param customerGroup the value for {@link CartDraft#getCustomerGroup()} * @return this builder */ public CartDraftBuilder customerGroup(@Nullable final Referenceable customerGroup) { this.customerGroup = Optional.ofNullable(customerGroup).map(Referenceable::toReference).orElse(null);; return this; } /** * Sets the {@code customerId} property of this builder. * * @param customerId the value for {@link CartDraft#getCustomerId()} * @return this builder */ public CartDraftBuilder customerId(@Nullable final String customerId) { this.customerId = customerId; return this; } /** * Sets the {@code deleteDaysAfterLastModification} property of this builder. * * @param deleteDaysAfterLastModification the value for {@link CartDraft#getDeleteDaysAfterLastModification()} * @return this builder */ public CartDraftBuilder deleteDaysAfterLastModification(@Nullable final Integer deleteDaysAfterLastModification) { this.deleteDaysAfterLastModification = deleteDaysAfterLastModification; return this; } /** * Sets the {@code inventoryMode} property of this builder. * * @param inventoryMode the value for {@link CartDraft#getInventoryMode()} * @return this builder */ public CartDraftBuilder inventoryMode(@Nullable final InventoryMode inventoryMode) { this.inventoryMode = inventoryMode; return this; } /** * Sets the {@code itemShippingAddresses} property of this builder. * * @param itemShippingAddresses the value for {@link CartDraft#getItemShippingAddresses()} * @return this builder */ public CartDraftBuilder itemShippingAddresses(@Nullable final List
itemShippingAddresses) { this.itemShippingAddresses = itemShippingAddresses; return this; } /** * Sets the {@code lineItems} property of this builder. * * @param lineItems the value for {@link CartDraft#getLineItems()} * @return this builder */ public CartDraftBuilder lineItems(@Nullable final List lineItems) { this.lineItems = lineItems; return this; } /** * Sets the {@code locale} property of this builder. * * @param locale the value for {@link CartDraft#getLocale()} * @return this builder */ public CartDraftBuilder locale(@Nullable final Locale locale) { this.locale = locale; return this; } /** * Sets the {@code origin} property of this builder. * * @param origin the value for {@link CartDraft#getOrigin()} * @return this builder */ public CartDraftBuilder origin(@Nullable final CartOrigin origin) { this.origin = origin; return this; } /** * Sets the {@code shippingAddress} property of this builder. * * @param shippingAddress the value for {@link CartDraft#getShippingAddress()} * @return this builder */ public CartDraftBuilder shippingAddress(@Nullable final Address shippingAddress) { this.shippingAddress = shippingAddress; return this; } /** * Sets the {@code shippingMethod} property of this builder. * * @param shippingMethod the value for {@link CartDraft#getShippingMethod()} * @return this builder */ public CartDraftBuilder shippingMethod(@Nullable final Referenceable shippingMethod) { this.shippingMethod = Optional.ofNullable(shippingMethod).map(Referenceable::toReference).orElse(null);; return this; } /** * Sets the {@code shippingRateInput} property of this builder. * * @param shippingRateInput the value for {@link CartDraft#getShippingRateInput()} * @return this builder */ public CartDraftBuilder shippingRateInput(@Nullable final ShippingRateInputDraft shippingRateInput) { this.shippingRateInput = shippingRateInput; return this; } /** * Sets the {@code taxCalculationMode} property of this builder. * * @param taxCalculationMode the value for {@link CartDraft#getTaxCalculationMode()} * @return this builder */ public CartDraftBuilder taxCalculationMode(@Nullable final TaxCalculationMode taxCalculationMode) { this.taxCalculationMode = taxCalculationMode; return this; } /** * Sets the {@code taxMode} property of this builder. * * @param taxMode the value for {@link CartDraft#getTaxMode()} * @return this builder */ public CartDraftBuilder taxMode(@Nullable final TaxMode taxMode) { this.taxMode = taxMode; return this; } /** * Sets the {@code taxRoundingMode} property of this builder. * * @param taxRoundingMode the value for {@link CartDraft#getTaxRoundingMode()} * @return this builder */ public CartDraftBuilder taxRoundingMode(@Nullable final RoundingMode taxRoundingMode) { this.taxRoundingMode = taxRoundingMode; return this; } @Nullable public String getAnonymousId() { return anonymousId; } @Nullable public Address getBillingAddress() { return billingAddress; } @Nullable public CountryCode getCountry() { return country; } public CurrencyUnit getCurrency() { return currency; } @Nullable public CustomFieldsDraft getCustom() { return custom; } @Nullable public List getCustomLineItems() { return customLineItems; } @Nullable public String getCustomerEmail() { return customerEmail; } @Nullable public Reference getCustomerGroup() { return customerGroup; } @Nullable public String getCustomerId() { return customerId; } @Nullable public Integer getDeleteDaysAfterLastModification() { return deleteDaysAfterLastModification; } @Nullable public InventoryMode getInventoryMode() { return inventoryMode; } @Nullable public List
getItemShippingAddresses() { return itemShippingAddresses; } @Nullable public List getLineItems() { return lineItems; } @Nullable public Locale getLocale() { return locale; } @Nullable public CartOrigin getOrigin() { return origin; } @Nullable public Address getShippingAddress() { return shippingAddress; } @Nullable public Reference getShippingMethod() { return shippingMethod; } @Nullable public ShippingRateInputDraft getShippingRateInput() { return shippingRateInput; } @Nullable public TaxCalculationMode getTaxCalculationMode() { return taxCalculationMode; } @Nullable public TaxMode getTaxMode() { return taxMode; } @Nullable public RoundingMode getTaxRoundingMode() { return taxRoundingMode; } /** * Concatenate {@code customLineItems} parameter to the {@code customLineItems} list property of this builder. * * @param customLineItems the value for {@link CartDraft#getCustomLineItems()} * @return this builder */ public CartDraftBuilder plusCustomLineItems(final List customLineItems) { this.customLineItems = SphereInternalUtils.listOf(Optional.ofNullable(this.customLineItems).orElseGet(ArrayList::new), customLineItems); return this; } /** * Concatenate {@code itemShippingAddresses} parameter to the {@code itemShippingAddresses} list property of this builder. * * @param itemShippingAddresses the value for {@link CartDraft#getItemShippingAddresses()} * @return this builder */ public CartDraftBuilder plusItemShippingAddresses(final List
itemShippingAddresses) { this.itemShippingAddresses = SphereInternalUtils.listOf(Optional.ofNullable(this.itemShippingAddresses).orElseGet(ArrayList::new), itemShippingAddresses); return this; } /** * Concatenate {@code lineItems} parameter to the {@code lineItems} list property of this builder. * * @param lineItems the value for {@link CartDraft#getLineItems()} * @return this builder */ public CartDraftBuilder plusLineItems(final List lineItems) { this.lineItems = SphereInternalUtils.listOf(Optional.ofNullable(this.lineItems).orElseGet(ArrayList::new), lineItems); return this; } /** * Adds {@code customLineItems} parameter to the {@code customLineItems} list property of this builder. * * @param customLineItems the value of the element to add to {@link CartDraft#getCustomLineItems()} * @return this builder */ public CartDraftBuilder plusCustomLineItems(final CustomLineItemDraft customLineItems) { this.customLineItems = SphereInternalUtils.listOf(Optional.ofNullable(this.customLineItems).orElseGet(ArrayList::new), Collections.singletonList(customLineItems)); return this; } /** * Adds {@code itemShippingAddresses} parameter to the {@code itemShippingAddresses} list property of this builder. * * @param itemShippingAddresses the value of the element to add to {@link CartDraft#getItemShippingAddresses()} * @return this builder */ public CartDraftBuilder plusItemShippingAddresses(final Address itemShippingAddresses) { this.itemShippingAddresses = SphereInternalUtils.listOf(Optional.ofNullable(this.itemShippingAddresses).orElseGet(ArrayList::new), Collections.singletonList(itemShippingAddresses)); return this; } /** * Adds {@code lineItems} parameter to the {@code lineItems} list property of this builder. * * @param lineItems the value of the element to add to {@link CartDraft#getLineItems()} * @return this builder */ public CartDraftBuilder plusLineItems(final LineItemDraft lineItems) { this.lineItems = SphereInternalUtils.listOf(Optional.ofNullable(this.lineItems).orElseGet(ArrayList::new), Collections.singletonList(lineItems)); return this; } /** * Creates a new instance of {@code CartDraftDsl} with the values of this builder. * * @return the instance */ public CartDraftDsl build() { return new CartDraftDsl(anonymousId, billingAddress, country, currency, custom, customLineItems, customerEmail, customerGroup, customerId, deleteDaysAfterLastModification, inventoryMode, itemShippingAddresses, lineItems, locale, origin, shippingAddress, shippingMethod, shippingRateInput, taxCalculationMode, taxMode, taxRoundingMode); } /** * Creates a new object initialized with the given values. * * @param currency initial value for the {@link CartDraft#getCurrency()} property * @return new object initialized with the given values */ public static CartDraftBuilder of(final CurrencyUnit currency) { return new CartDraftBuilder(null, null, null, currency, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null); } /** * 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 CartDraftBuilder of(final CartDraft template) { return new CartDraftBuilder(template.getAnonymousId(), template.getBillingAddress(), template.getCountry(), template.getCurrency(), template.getCustom(), template.getCustomLineItems(), template.getCustomerEmail(), template.getCustomerGroup(), template.getCustomerId(), template.getDeleteDaysAfterLastModification(), template.getInventoryMode(), template.getItemShippingAddresses(), template.getLineItems(), template.getLocale(), template.getOrigin(), template.getShippingAddress(), template.getShippingMethod(), template.getShippingRateInput(), template.getTaxCalculationMode(), template.getTaxMode(), template.getTaxRoundingMode()); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy