io.sphere.sdk.carts.CartDraftDsl Maven / Gradle / Ivy
package io.sphere.sdk.carts;
import com.fasterxml.jackson.annotation.JsonCreator;
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.Reference;
import io.sphere.sdk.models.Referenceable;
import io.sphere.sdk.shippingmethods.ShippingMethod;
import io.sphere.sdk.types.CustomFieldsDraft;
import java.lang.Integer;
import java.lang.String;
import java.util.List;
import java.util.Locale;
import java.util.Optional;
import javax.annotation.Generated;
import javax.annotation.Nullable;
import javax.money.CurrencyUnit;
/**
* Dsl class for {@link CartDraft}.
*/
@Generated(
value = "io.sphere.sdk.annotations.processors.generators.ResourceDraftValueGenerator",
comments = "Generated from: io.sphere.sdk.carts.CartDraft"
)
public final class CartDraftDsl extends Base implements CartDraft {
@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 lineItems;
@Nullable
private Locale locale;
@Nullable
private Address shippingAddress;
@Nullable
private Reference shippingMethod;
@Nullable
private ShippingRateInputDraft shippingRateInput;
@Nullable
private TaxCalculationMode taxCalculationMode;
@Nullable
private TaxMode taxMode;
@Nullable
private RoundingMode taxRoundingMode;
@JsonCreator
CartDraftDsl(@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 lineItems,
@Nullable final Locale locale, @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.lineItems = lineItems;
this.locale = locale;
this.shippingAddress = shippingAddress;
this.shippingMethod = shippingMethod;
this.shippingRateInput = shippingRateInput;
this.taxCalculationMode = taxCalculationMode;
this.taxMode = taxMode;
this.taxRoundingMode = taxRoundingMode;
}
@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 getLineItems() {
return lineItems;
}
@Nullable
public Locale getLocale() {
return locale;
}
@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;
}
/**
* Creates a new builder with the values of this object.
*
* @return new builder
*/
public CartDraftBuilder newBuilder() {
return new CartDraftBuilder(anonymousId, billingAddress, country, currency, custom, customLineItems, customerEmail, customerGroup, customerId, deleteDaysAfterLastModification, inventoryMode, lineItems, locale, shippingAddress, shippingMethod, shippingRateInput, taxCalculationMode, taxMode, taxRoundingMode);
}
public CartDraftDsl withAnonymousId(@Nullable final String anonymousId) {
return newBuilder().anonymousId(anonymousId).build();
}
public CartDraftDsl withBillingAddress(@Nullable final Address billingAddress) {
return newBuilder().billingAddress(billingAddress).build();
}
public CartDraftDsl withCountry(@Nullable final CountryCode country) {
return newBuilder().country(country).build();
}
public CartDraftDsl withCurrency(final CurrencyUnit currency) {
return newBuilder().currency(currency).build();
}
public CartDraftDsl withCustom(@Nullable final CustomFieldsDraft custom) {
return newBuilder().custom(custom).build();
}
public CartDraftDsl withCustomLineItems(@Nullable final List customLineItems) {
return newBuilder().customLineItems(customLineItems).build();
}
public CartDraftDsl withCustomerEmail(@Nullable final String customerEmail) {
return newBuilder().customerEmail(customerEmail).build();
}
public CartDraftDsl withCustomerGroup(@Nullable final Referenceable customerGroup) {
return newBuilder().customerGroup(Optional.ofNullable(customerGroup).map(Referenceable::toReference).orElse(null)).build();
}
public CartDraftDsl withCustomerId(@Nullable final String customerId) {
return newBuilder().customerId(customerId).build();
}
public CartDraftDsl withDeleteDaysAfterLastModification(@Nullable final Integer deleteDaysAfterLastModification) {
return newBuilder().deleteDaysAfterLastModification(deleteDaysAfterLastModification).build();
}
public CartDraftDsl withInventoryMode(@Nullable final InventoryMode inventoryMode) {
return newBuilder().inventoryMode(inventoryMode).build();
}
public CartDraftDsl withLineItems(@Nullable final List lineItems) {
return newBuilder().lineItems(lineItems).build();
}
public CartDraftDsl withLocale(@Nullable final Locale locale) {
return newBuilder().locale(locale).build();
}
public CartDraftDsl withShippingAddress(@Nullable final Address shippingAddress) {
return newBuilder().shippingAddress(shippingAddress).build();
}
public CartDraftDsl withShippingMethod(@Nullable final Referenceable shippingMethod) {
return newBuilder().shippingMethod(Optional.ofNullable(shippingMethod).map(Referenceable::toReference).orElse(null)).build();
}
public CartDraftDsl withShippingRateInput(@Nullable final ShippingRateInputDraft shippingRateInput) {
return newBuilder().shippingRateInput(shippingRateInput).build();
}
public CartDraftDsl withTaxCalculationMode(@Nullable final TaxCalculationMode taxCalculationMode) {
return newBuilder().taxCalculationMode(taxCalculationMode).build();
}
public CartDraftDsl withTaxMode(@Nullable final TaxMode taxMode) {
return newBuilder().taxMode(taxMode).build();
}
public CartDraftDsl withTaxRoundingMode(@Nullable final RoundingMode taxRoundingMode) {
return newBuilder().taxRoundingMode(taxRoundingMode).build();
}
/**
* 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 CartDraftDsl of(final CurrencyUnit currency) {
return new CartDraftDsl(null, null, null, currency, 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 CartDraftDsl of(final CartDraft template) {
return new CartDraftDsl(template.getAnonymousId(), template.getBillingAddress(), template.getCountry(), template.getCurrency(), template.getCustom(), template.getCustomLineItems(), template.getCustomerEmail(), template.getCustomerGroup(), template.getCustomerId(), template.getDeleteDaysAfterLastModification(), template.getInventoryMode(), template.getLineItems(), template.getLocale(), template.getShippingAddress(), template.getShippingMethod(), template.getShippingRateInput(), template.getTaxCalculationMode(), template.getTaxMode(), template.getTaxRoundingMode());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy