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

io.sphere.sdk.carts.CartDraftBuilderBase 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.ResourceIdentifier;
import io.sphere.sdk.shippingmethods.ShippingMethod;
import io.sphere.sdk.stores.Store;
import io.sphere.sdk.taxcategories.ExternalTaxRateDraft;
import io.sphere.sdk.types.CustomFieldsDraft;
import io.sphere.sdk.utils.SphereInternalUtils;
import java.lang.Integer;
import java.lang.String;
import java.lang.SuppressWarnings;
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;

/**
 * Abstract base builder for {@link CartDraft} 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.CartDraft"
)
abstract class CartDraftBuilderBase extends Base implements Builder {
  @Nullable
  String anonymousId;

  @Nullable
  Address billingAddress;

  @Nullable
  CountryCode country;

  CurrencyUnit currency;

  @Nullable
  CustomFieldsDraft custom;

  @Nullable
  List customLineItems;

  @Nullable
  String customerEmail;

  @Nullable
  ResourceIdentifier customerGroup;

  @Nullable
  String customerId;

  @Nullable
  Integer deleteDaysAfterLastModification;

  @Nullable
  List discountCodes;

  @Nullable
  ExternalTaxRateDraft externalTaxRateForShippingMethod;

  @Nullable
  InventoryMode inventoryMode;

  @Nullable
  List
itemShippingAddresses; @Nullable List lineItems; @Nullable Locale locale; @Nullable CartOrigin origin; @Nullable Address shippingAddress; @Nullable ResourceIdentifier shippingMethod; @Nullable ShippingRateInputDraft shippingRateInput; @Nullable ResourceIdentifier store; @Nullable TaxCalculationMode taxCalculationMode; @Nullable TaxMode taxMode; @Nullable RoundingMode taxRoundingMode; protected CartDraftBuilderBase() { } protected CartDraftBuilderBase(@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 ResourceIdentifier customerGroup, @Nullable final String customerId, @Nullable final Integer deleteDaysAfterLastModification, @Nullable final List discountCodes, @Nullable final ExternalTaxRateDraft externalTaxRateForShippingMethod, @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 ResourceIdentifier shippingMethod, @Nullable final ShippingRateInputDraft shippingRateInput, @Nullable final ResourceIdentifier store, @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.discountCodes = discountCodes; this.externalTaxRateForShippingMethod = externalTaxRateForShippingMethod; 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.store = store; 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 */ @SuppressWarnings("unchecked") public T anonymousId(@Nullable final String anonymousId) { this.anonymousId = anonymousId; return (T) this; } /** * Sets the {@code billingAddress} property of this builder. * * @param billingAddress the value for {@link CartDraft#getBillingAddress()} * @return this builder */ @SuppressWarnings("unchecked") public T billingAddress(@Nullable final Address billingAddress) { this.billingAddress = billingAddress; return (T) this; } /** * Sets the {@code country} property of this builder. * * @param country the value for {@link CartDraft#getCountry()} * @return this builder */ @SuppressWarnings("unchecked") public T country(@Nullable final CountryCode country) { this.country = country; return (T) this; } /** * Sets the {@code currency} property of this builder. * * @param currency the value for {@link CartDraft#getCurrency()} * @return this builder */ @SuppressWarnings("unchecked") public T currency(final CurrencyUnit currency) { this.currency = currency; return (T) this; } /** * Sets the {@code custom} property of this builder. * * @param custom the value for {@link CartDraft#getCustom()} * @return this builder */ @SuppressWarnings("unchecked") public T custom(@Nullable final CustomFieldsDraft custom) { this.custom = custom; return (T) this; } /** * Sets the {@code customLineItems} property of this builder. * * @param customLineItems the value for {@link CartDraft#getCustomLineItems()} * @return this builder */ @SuppressWarnings("unchecked") public T customLineItems(@Nullable final List customLineItems) { this.customLineItems = customLineItems; return (T) this; } /** * Sets the {@code customerEmail} property of this builder. * * @param customerEmail the value for {@link CartDraft#getCustomerEmail()} * @return this builder */ @SuppressWarnings("unchecked") public T customerEmail(@Nullable final String customerEmail) { this.customerEmail = customerEmail; return (T) this; } /** * Sets the {@code customerGroup} property of this builder. * * @param customerGroup the value for {@link CartDraft#getCustomerGroup()} * @return this builder */ @SuppressWarnings("unchecked") public T customerGroup(@Nullable final ResourceIdentifier customerGroup) { this.customerGroup = customerGroup; return (T) this; } /** * Sets the {@code customerId} property of this builder. * * @param customerId the value for {@link CartDraft#getCustomerId()} * @return this builder */ @SuppressWarnings("unchecked") public T customerId(@Nullable final String customerId) { this.customerId = customerId; return (T) this; } /** * Sets the {@code deleteDaysAfterLastModification} property of this builder. * * @param deleteDaysAfterLastModification the value for {@link CartDraft#getDeleteDaysAfterLastModification()} * @return this builder */ @SuppressWarnings("unchecked") public T deleteDaysAfterLastModification( @Nullable final Integer deleteDaysAfterLastModification) { this.deleteDaysAfterLastModification = deleteDaysAfterLastModification; return (T) this; } /** * Sets the {@code discountCodes} property of this builder. * * @param discountCodes the value for {@link CartDraft#getDiscountCodes()} * @return this builder */ @SuppressWarnings("unchecked") public T discountCodes(@Nullable final List discountCodes) { this.discountCodes = discountCodes; return (T) this; } /** * Sets the {@code externalTaxRateForShippingMethod} property of this builder. * * @param externalTaxRateForShippingMethod the value for {@link CartDraft#getExternalTaxRateForShippingMethod()} * @return this builder */ @SuppressWarnings("unchecked") public T externalTaxRateForShippingMethod( @Nullable final ExternalTaxRateDraft externalTaxRateForShippingMethod) { this.externalTaxRateForShippingMethod = externalTaxRateForShippingMethod; return (T) this; } /** * Sets the {@code inventoryMode} property of this builder. * * @param inventoryMode the value for {@link CartDraft#getInventoryMode()} * @return this builder */ @SuppressWarnings("unchecked") public T inventoryMode(@Nullable final InventoryMode inventoryMode) { this.inventoryMode = inventoryMode; return (T) this; } /** * Sets the {@code itemShippingAddresses} property of this builder. * * @param itemShippingAddresses the value for {@link CartDraft#getItemShippingAddresses()} * @return this builder */ @SuppressWarnings("unchecked") public T itemShippingAddresses(@Nullable final List
itemShippingAddresses) { this.itemShippingAddresses = itemShippingAddresses; return (T) this; } /** * Sets the {@code lineItems} property of this builder. * * @param lineItems the value for {@link CartDraft#getLineItems()} * @return this builder */ @SuppressWarnings("unchecked") public T lineItems(@Nullable final List lineItems) { this.lineItems = lineItems; return (T) this; } /** * Sets the {@code locale} property of this builder. * * @param locale the value for {@link CartDraft#getLocale()} * @return this builder */ @SuppressWarnings("unchecked") public T locale(@Nullable final Locale locale) { this.locale = locale; return (T) this; } /** * Sets the {@code origin} property of this builder. * * @param origin the value for {@link CartDraft#getOrigin()} * @return this builder */ @SuppressWarnings("unchecked") public T origin(@Nullable final CartOrigin origin) { this.origin = origin; return (T) this; } /** * Sets the {@code shippingAddress} property of this builder. * * @param shippingAddress the value for {@link CartDraft#getShippingAddress()} * @return this builder */ @SuppressWarnings("unchecked") public T shippingAddress(@Nullable final Address shippingAddress) { this.shippingAddress = shippingAddress; return (T) this; } /** * Sets the {@code shippingMethod} property of this builder. * * @param shippingMethod the value for {@link CartDraft#getShippingMethod()} * @return this builder */ @SuppressWarnings("unchecked") public T shippingMethod(@Nullable final ResourceIdentifier shippingMethod) { this.shippingMethod = shippingMethod; return (T) this; } /** * Sets the {@code shippingRateInput} property of this builder. * * @param shippingRateInput the value for {@link CartDraft#getShippingRateInput()} * @return this builder */ @SuppressWarnings("unchecked") public T shippingRateInput(@Nullable final ShippingRateInputDraft shippingRateInput) { this.shippingRateInput = shippingRateInput; return (T) this; } /** * Sets the {@code store} property of this builder. * * @param store the value for {@link CartDraft#getStore()} * @return this builder */ @SuppressWarnings("unchecked") public T store(@Nullable final ResourceIdentifier store) { this.store = store; return (T) this; } /** * Sets the {@code taxCalculationMode} property of this builder. * * @param taxCalculationMode the value for {@link CartDraft#getTaxCalculationMode()} * @return this builder */ @SuppressWarnings("unchecked") public T taxCalculationMode(@Nullable final TaxCalculationMode taxCalculationMode) { this.taxCalculationMode = taxCalculationMode; return (T) this; } /** * Sets the {@code taxMode} property of this builder. * * @param taxMode the value for {@link CartDraft#getTaxMode()} * @return this builder */ @SuppressWarnings("unchecked") public T taxMode(@Nullable final TaxMode taxMode) { this.taxMode = taxMode; return (T) this; } /** * Sets the {@code taxRoundingMode} property of this builder. * * @param taxRoundingMode the value for {@link CartDraft#getTaxRoundingMode()} * @return this builder */ @SuppressWarnings("unchecked") public T taxRoundingMode(@Nullable final RoundingMode taxRoundingMode) { this.taxRoundingMode = taxRoundingMode; return (T) 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 ResourceIdentifier getCustomerGroup() { return customerGroup; } @Nullable public String getCustomerId() { return customerId; } @Nullable public Integer getDeleteDaysAfterLastModification() { return deleteDaysAfterLastModification; } @Nullable public List getDiscountCodes() { return discountCodes; } @Nullable public ExternalTaxRateDraft getExternalTaxRateForShippingMethod() { return externalTaxRateForShippingMethod; } @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 ResourceIdentifier getShippingMethod() { return shippingMethod; } @Nullable public ShippingRateInputDraft getShippingRateInput() { return shippingRateInput; } @Nullable public ResourceIdentifier getStore() { return store; } @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 */ @SuppressWarnings("unchecked") public T plusCustomLineItems(final List customLineItems) { this.customLineItems = SphereInternalUtils.listOf(Optional.ofNullable(this.customLineItems).orElseGet(ArrayList::new), customLineItems); return (T) this; } /** * Concatenate {@code discountCodes} parameter to the {@code discountCodes} list property of this builder. * * @param discountCodes the value for {@link CartDraft#getDiscountCodes()} * @return this builder */ @SuppressWarnings("unchecked") public T plusDiscountCodes(final List discountCodes) { this.discountCodes = SphereInternalUtils.listOf(Optional.ofNullable(this.discountCodes).orElseGet(ArrayList::new), discountCodes); return (T) 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 */ @SuppressWarnings("unchecked") public T plusItemShippingAddresses(final List
itemShippingAddresses) { this.itemShippingAddresses = SphereInternalUtils.listOf(Optional.ofNullable(this.itemShippingAddresses).orElseGet(ArrayList::new), itemShippingAddresses); return (T) 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 */ @SuppressWarnings("unchecked") public T plusLineItems(final List lineItems) { this.lineItems = SphereInternalUtils.listOf(Optional.ofNullable(this.lineItems).orElseGet(ArrayList::new), lineItems); return (T) 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 */ @SuppressWarnings("unchecked") public T plusCustomLineItems(final CustomLineItemDraft customLineItems) { this.customLineItems = SphereInternalUtils.listOf(Optional.ofNullable(this.customLineItems).orElseGet(ArrayList::new), Collections.singletonList(customLineItems)); return (T) this; } /** * Adds {@code discountCodes} parameter to the {@code discountCodes} list property of this builder. * * @param discountCodes the value of the element to add to {@link CartDraft#getDiscountCodes()} * @return this builder */ @SuppressWarnings("unchecked") public T plusDiscountCodes(final String discountCodes) { this.discountCodes = SphereInternalUtils.listOf(Optional.ofNullable(this.discountCodes).orElseGet(ArrayList::new), Collections.singletonList(discountCodes)); return (T) 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 */ @SuppressWarnings("unchecked") public T plusItemShippingAddresses(final Address itemShippingAddresses) { this.itemShippingAddresses = SphereInternalUtils.listOf(Optional.ofNullable(this.itemShippingAddresses).orElseGet(ArrayList::new), Collections.singletonList(itemShippingAddresses)); return (T) 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 */ @SuppressWarnings("unchecked") public T plusLineItems(final LineItemDraft lineItems) { this.lineItems = SphereInternalUtils.listOf(Optional.ofNullable(this.lineItems).orElseGet(ArrayList::new), Collections.singletonList(lineItems)); return (T) 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, discountCodes, externalTaxRateForShippingMethod, inventoryMode, itemShippingAddresses, lineItems, locale, origin, shippingAddress, shippingMethod, shippingRateInput, store, 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, 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.getDiscountCodes(), template.getExternalTaxRateForShippingMethod(), template.getInventoryMode(), template.getItemShippingAddresses(), template.getLineItems(), template.getLocale(), template.getOrigin(), template.getShippingAddress(), template.getShippingMethod(), template.getShippingRateInput(), template.getStore(), template.getTaxCalculationMode(), template.getTaxMode(), template.getTaxRoundingMode()); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy