io.sphere.sdk.carts.CartDraftBuilder Maven / Gradle / Ivy
/*
This class has been generated by class io.sphere.sdk.annotations.processors.ResourceDraftValueAnnotationProcessor
induced by the annotation io.sphere.sdk.annotations.ResourceDraftValue.
in the source class io.sphere.sdk.carts.CartDraft.
*/
package io.sphere.sdk.carts;
import javax.annotation.Nullable;
import io.sphere.sdk.models.*;
import java.util.*;
import io.sphere.sdk.utils.*;
import com.fasterxml.jackson.annotation.*;
import io.sphere.sdk.models.Builder;
import com.fasterxml.jackson.annotation.JsonCreator;
/** Builder for {@link CartDraft}. */
public final class CartDraftBuilder extends io.sphere.sdk.models.Base implements Builder {
private javax.money.CurrencyUnit currency;
@Nullable()
private java.lang.String customerId;
@Nullable()
private com.neovisionaries.i18n.CountryCode country;
@Nullable()
private io.sphere.sdk.carts.InventoryMode inventoryMode;
@Nullable()
private java.lang.String customerEmail;
@Nullable()
private io.sphere.sdk.models.Address billingAddress;
@Nullable()
private java.util.List customLineItems;
@Nullable()
private java.util.List lineItems;
@Nullable()
private io.sphere.sdk.models.Address shippingAddress;
@Nullable()
private io.sphere.sdk.models.Reference shippingMethod;
@Nullable()
private io.sphere.sdk.types.CustomFieldsDraft custom;
@Nullable()
private io.sphere.sdk.carts.TaxMode taxMode;
@Nullable()
private java.lang.String anonymousId;
@Nullable()
private java.util.Locale locale;
@Nullable()
private io.sphere.sdk.carts.RoundingMode taxRoundingMode;
@JsonCreator()
CartDraftBuilder(final java.lang.String anonymousId, final io.sphere.sdk.models.Address billingAddress, final com.neovisionaries.i18n.CountryCode country, final javax.money.CurrencyUnit currency, final io.sphere.sdk.types.CustomFieldsDraft custom, final java.util.List customLineItems, final java.lang.String customerEmail, final java.lang.String customerId, final io.sphere.sdk.carts.InventoryMode inventoryMode, final java.util.List lineItems, final java.util.Locale locale, final io.sphere.sdk.models.Address shippingAddress, final io.sphere.sdk.models.Reference shippingMethod, final io.sphere.sdk.carts.TaxMode taxMode, final io.sphere.sdk.carts.RoundingMode taxRoundingMode) {
this.anonymousId = anonymousId;
this.billingAddress = billingAddress;
this.country = country;
this.currency = currency;
this.custom = custom;
this.customLineItems = customLineItems;
this.customerEmail = customerEmail;
this.customerId = customerId;
this.inventoryMode = inventoryMode;
this.lineItems = lineItems;
this.locale = locale;
this.shippingAddress = shippingAddress;
this.shippingMethod = shippingMethod;
this.taxMode = taxMode;
this.taxRoundingMode = taxRoundingMode;
}
public CartDraftBuilder currency(final javax.money.CurrencyUnit currency) {
this.currency = currency;
return this;
}
public CartDraftBuilder customerId(@Nullable() final java.lang.String customerId) {
this.customerId = customerId;
return this;
}
public CartDraftBuilder country(@Nullable() final com.neovisionaries.i18n.CountryCode country) {
this.country = country;
return this;
}
public CartDraftBuilder inventoryMode(@Nullable() final io.sphere.sdk.carts.InventoryMode inventoryMode) {
this.inventoryMode = inventoryMode;
return this;
}
public CartDraftBuilder customerEmail(@Nullable() final java.lang.String customerEmail) {
this.customerEmail = customerEmail;
return this;
}
public CartDraftBuilder billingAddress(@Nullable() final io.sphere.sdk.models.Address billingAddress) {
this.billingAddress = billingAddress;
return this;
}
public CartDraftBuilder customLineItems(@Nullable() final java.util.List customLineItems) {
this.customLineItems = customLineItems;
return this;
}
public CartDraftBuilder lineItems(@Nullable() final java.util.List lineItems) {
this.lineItems = lineItems;
return this;
}
public CartDraftBuilder shippingAddress(@Nullable() final io.sphere.sdk.models.Address shippingAddress) {
this.shippingAddress = shippingAddress;
return this;
}
public CartDraftBuilder shippingMethod(@Nullable() final io.sphere.sdk.models.Referenceable shippingMethod) {
this.shippingMethod = Optional.ofNullable(shippingMethod).map(Referenceable::toReference).orElse(null);
return this;
}
public CartDraftBuilder custom(@Nullable() final io.sphere.sdk.types.CustomFieldsDraft custom) {
this.custom = custom;
return this;
}
public CartDraftBuilder taxMode(@Nullable() final io.sphere.sdk.carts.TaxMode taxMode) {
this.taxMode = taxMode;
return this;
}
public CartDraftBuilder anonymousId(@Nullable() final java.lang.String anonymousId) {
this.anonymousId = anonymousId;
return this;
}
public CartDraftBuilder locale(@Nullable() final java.util.Locale locale) {
this.locale = locale;
return this;
}
public CartDraftBuilder taxRoundingMode(@Nullable() final io.sphere.sdk.carts.RoundingMode taxRoundingMode) {
this.taxRoundingMode = taxRoundingMode;
return this;
}
public CartDraftDsl build() {
return new CartDraftDsl(anonymousId, billingAddress, country, currency, custom, customLineItems, customerEmail, customerId, inventoryMode, lineItems, locale, shippingAddress, shippingMethod, taxMode, taxRoundingMode);
}
public static CartDraftBuilder of(final javax.money.CurrencyUnit currency) {
return new CartDraftBuilder(null, null, null, currency, null, null, null, null, null, null, null, null, null, null, null);
}
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.getCustomerId(), template.getInventoryMode(), template.getLineItems(), template.getLocale(), template.getShippingAddress(), template.getShippingMethod(), template.getTaxMode(), template.getTaxRoundingMode());
}
@Nullable()
public java.lang.String getAnonymousId() {
return anonymousId;
}
@Nullable()
public io.sphere.sdk.models.Address getBillingAddress() {
return billingAddress;
}
@Nullable()
public com.neovisionaries.i18n.CountryCode getCountry() {
return country;
}
public javax.money.CurrencyUnit getCurrency() {
return currency;
}
@Nullable()
public io.sphere.sdk.types.CustomFieldsDraft getCustom() {
return custom;
}
@Nullable()
public java.util.List getCustomLineItems() {
return customLineItems;
}
@Nullable()
public java.lang.String getCustomerEmail() {
return customerEmail;
}
@Nullable()
public java.lang.String getCustomerId() {
return customerId;
}
@Nullable()
public io.sphere.sdk.carts.InventoryMode getInventoryMode() {
return inventoryMode;
}
@Nullable()
public java.util.List getLineItems() {
return lineItems;
}
@Nullable()
public java.util.Locale getLocale() {
return locale;
}
@Nullable()
public io.sphere.sdk.models.Address getShippingAddress() {
return shippingAddress;
}
@Nullable()
public io.sphere.sdk.models.Reference getShippingMethod() {
return shippingMethod;
}
@Nullable()
public io.sphere.sdk.carts.TaxMode getTaxMode() {
return taxMode;
}
@Nullable()
public io.sphere.sdk.carts.RoundingMode getTaxRoundingMode() {
return taxRoundingMode;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy