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

io.sphere.sdk.orders.OrderFromCartDraftBuilder Maven / Gradle / Ivy

The newest version!
package io.sphere.sdk.orders;

import io.sphere.sdk.carts.Cart;
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.models.ResourceIdentifier;
import io.sphere.sdk.states.State;
import io.sphere.sdk.types.CustomFieldsDraft;
import java.lang.Deprecated;
import java.lang.Long;
import java.lang.String;
import java.util.Optional;
import javax.annotation.Generated;
import javax.annotation.Nullable;

/**
 * Builder for {@link OrderFromCartDraft}.
 */
@Generated(
    value = "io.sphere.sdk.annotations.processors.generators.DraftBuilderGenerator",
    comments = "Generated from: io.sphere.sdk.orders.OrderFromCartDraft"
)
public final class OrderFromCartDraftBuilder extends Base implements Builder {
  private ResourceIdentifier cart;

  @Nullable
  private CustomFieldsDraft custom;

  @Nullable
  private String id;

  @Nullable
  private String orderNumber;

  @Nullable
  private OrderState orderState;

  @Nullable
  private PaymentState paymentState;

  @Nullable
  private ShipmentState shipmentState;

  @Nullable
  private Reference state;

  private Long version;

  OrderFromCartDraftBuilder() {
  }

  OrderFromCartDraftBuilder(final ResourceIdentifier cart,
      @Nullable final CustomFieldsDraft custom, @Nullable final String id,
      @Nullable final String orderNumber, @Nullable final OrderState orderState,
      @Nullable final PaymentState paymentState, @Nullable final ShipmentState shipmentState,
      @Nullable final Reference state, final Long version) {
    this.cart = cart;
    this.custom = custom;
    this.id = id;
    this.orderNumber = orderNumber;
    this.orderState = orderState;
    this.paymentState = paymentState;
    this.shipmentState = shipmentState;
    this.state = state;
    this.version = version;
  }

  /**
   * Sets the {@code cart} property of this builder.
   *
   * @param cart the value for {@link OrderFromCartDraft#getCart()}
   * @return this builder
   */
  public OrderFromCartDraftBuilder cart(final ResourceIdentifier cart) {
    this.cart = cart;
    return this;
  }

  /**
   * Sets the {@code custom} property of this builder.
   *
   * @param custom the value for {@link OrderFromCartDraft#getCustom()}
   * @return this builder
   */
  public OrderFromCartDraftBuilder custom(@Nullable final CustomFieldsDraft custom) {
    this.custom = custom;
    return this;
  }

  /**
   * Sets the {@code id} property of this builder.
   *
   * @param id the value for {@link OrderFromCartDraft#getId()}
   * @return this builder
   *
   * @deprecated This method will be removed with the next major SDK update.
   */
  @Deprecated
  public OrderFromCartDraftBuilder id(@Nullable final String id) {
    this.id = id;
    return this;
  }

  /**
   * Sets the {@code orderNumber} property of this builder.
   *
   * @param orderNumber the value for {@link OrderFromCartDraft#getOrderNumber()}
   * @return this builder
   */
  public OrderFromCartDraftBuilder orderNumber(@Nullable final String orderNumber) {
    this.orderNumber = orderNumber;
    return this;
  }

  /**
   * Sets the {@code orderState} property of this builder.
   *
   * @param orderState the value for {@link OrderFromCartDraft#getOrderState()}
   * @return this builder
   */
  public OrderFromCartDraftBuilder orderState(@Nullable final OrderState orderState) {
    this.orderState = orderState;
    return this;
  }

  /**
   * Sets the {@code paymentState} property of this builder.
   *
   * @param paymentState the value for {@link OrderFromCartDraft#getPaymentState()}
   * @return this builder
   */
  public OrderFromCartDraftBuilder paymentState(@Nullable final PaymentState paymentState) {
    this.paymentState = paymentState;
    return this;
  }

  /**
   * Sets the {@code shipmentState} property of this builder.
   *
   * @param shipmentState the value for {@link OrderFromCartDraft#getShipmentState()}
   * @return this builder
   */
  public OrderFromCartDraftBuilder shipmentState(@Nullable final ShipmentState shipmentState) {
    this.shipmentState = shipmentState;
    return this;
  }

  /**
   * Sets the {@code state} property of this builder.
   *
   * @param state the value for {@link OrderFromCartDraft#getState()}
   * @return this builder
   */
  public OrderFromCartDraftBuilder state(@Nullable final Referenceable state) {
    this.state = Optional.ofNullable(state).map(Referenceable::toReference).orElse(null);;
    return this;
  }

  /**
   * Sets the {@code version} property of this builder.
   *
   * @param version the value for {@link OrderFromCartDraft#getVersion()}
   * @return this builder
   */
  public OrderFromCartDraftBuilder version(final Long version) {
    this.version = version;
    return this;
  }

  public ResourceIdentifier getCart() {
    return cart;
  }

  @Nullable
  public CustomFieldsDraft getCustom() {
    return custom;
  }

  /**
   *
   * @deprecated This method will be removed with the next major SDK update.
   */
  @Nullable
  @Deprecated
  public String getId() {
    return id;
  }

  @Nullable
  public String getOrderNumber() {
    return orderNumber;
  }

  @Nullable
  public OrderState getOrderState() {
    return orderState;
  }

  @Nullable
  public PaymentState getPaymentState() {
    return paymentState;
  }

  @Nullable
  public ShipmentState getShipmentState() {
    return shipmentState;
  }

  @Nullable
  public Reference getState() {
    return state;
  }

  public Long getVersion() {
    return version;
  }

  /**
   * Creates a new instance of {@code OrderFromCartDraftDsl} with the values of this builder.
   *
   * @return the instance
   */
  public OrderFromCartDraftDsl build() {
    return new OrderFromCartDraftDsl(cart, custom, id, orderNumber, orderState, paymentState, shipmentState, state, version);
  }

  /**
   * Creates a new object initialized with the given values.
   *
   * @param id initial value for the {@link OrderFromCartDraft#getId()} property
   * @param version initial value for the {@link OrderFromCartDraft#getVersion()} property
   * @param orderNumber initial value for the {@link OrderFromCartDraft#getOrderNumber()} property
   * @param paymentState initial value for the {@link OrderFromCartDraft#getPaymentState()} property
   * @return new object initialized with the given values
   */
  public static OrderFromCartDraftBuilder of(@Nullable final String id, final Long version,
      @Nullable final String orderNumber, @Nullable final PaymentState paymentState) {
    return new OrderFromCartDraftBuilder(null, null, id, orderNumber, null, paymentState, null, null, version);
  }

  /**
   * Creates a new object initialized with the given values.
   *
   * @param id initial value for the {@link OrderFromCartDraft#getId()} property
   * @param version initial value for the {@link OrderFromCartDraft#getVersion()} property
   * @return new object initialized with the given values
   */
  public static OrderFromCartDraftBuilder of(@Nullable final String id, final Long version) {
    return new OrderFromCartDraftBuilder(null, null, id, null, null, null, null, null, version);
  }

  /**
   * Creates a new object initialized with the given values.
   *
   * @param cart initial value for the {@link OrderFromCartDraft#getCart()} property
   * @param version initial value for the {@link OrderFromCartDraft#getVersion()} property
   * @param orderNumber initial value for the {@link OrderFromCartDraft#getOrderNumber()} property
   * @param paymentState initial value for the {@link OrderFromCartDraft#getPaymentState()} property
   * @return new object initialized with the given values
   */
  public static OrderFromCartDraftBuilder of(final ResourceIdentifier cart,
      final Long version, @Nullable final String orderNumber,
      @Nullable final PaymentState paymentState) {
    return new OrderFromCartDraftBuilder(cart, null, null, orderNumber, null, paymentState, null, null, version);
  }

  /**
   * Creates a new object initialized with the given values.
   *
   * @param cart initial value for the {@link OrderFromCartDraft#getCart()} property
   * @param version initial value for the {@link OrderFromCartDraft#getVersion()} property
   * @return new object initialized with the given values
   */
  public static OrderFromCartDraftBuilder of(final ResourceIdentifier cart,
      final Long version) {
    return new OrderFromCartDraftBuilder(cart, null, null, null, null, null, null, null, version);
  }

  /**
   * 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 OrderFromCartDraftBuilder of(final OrderFromCartDraft template) {
    return new OrderFromCartDraftBuilder(template.getCart(), template.getCustom(), template.getId(), template.getOrderNumber(), template.getOrderState(), template.getPaymentState(), template.getShipmentState(), template.getState(), template.getVersion());
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy