io.sphere.sdk.orders.OrderFromCartDraftDsl Maven / Gradle / Ivy
The newest version!
package io.sphere.sdk.orders;
import com.fasterxml.jackson.annotation.JsonCreator;
import io.sphere.sdk.carts.Cart;
import io.sphere.sdk.models.Base;
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;
/**
* Dsl class for {@link OrderFromCartDraft}.
*/
@Generated(
value = "io.sphere.sdk.annotations.processors.generators.ResourceDraftValueGenerator",
comments = "Generated from: io.sphere.sdk.orders.OrderFromCartDraft"
)
public final class OrderFromCartDraftDsl extends Base implements OrderFromCartDraft {
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;
@JsonCreator
OrderFromCartDraftDsl(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;
}
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 builder with the values of this object.
*
* @return new builder
*/
public OrderFromCartDraftBuilder newBuilder() {
return new OrderFromCartDraftBuilder(cart, custom, id, orderNumber, orderState, paymentState, shipmentState, state, version);
}
public OrderFromCartDraftDsl withCart(final ResourceIdentifier cart) {
return newBuilder().cart(cart).build();
}
public OrderFromCartDraftDsl withCustom(@Nullable final CustomFieldsDraft custom) {
return newBuilder().custom(custom).build();
}
/**
*
* @deprecated This method will be removed with the next major SDK update.
*/
@Deprecated
public OrderFromCartDraftDsl withId(@Nullable final String id) {
return newBuilder().id(id).build();
}
public OrderFromCartDraftDsl withOrderNumber(@Nullable final String orderNumber) {
return newBuilder().orderNumber(orderNumber).build();
}
public OrderFromCartDraftDsl withOrderState(@Nullable final OrderState orderState) {
return newBuilder().orderState(orderState).build();
}
public OrderFromCartDraftDsl withPaymentState(@Nullable final PaymentState paymentState) {
return newBuilder().paymentState(paymentState).build();
}
public OrderFromCartDraftDsl withShipmentState(@Nullable final ShipmentState shipmentState) {
return newBuilder().shipmentState(shipmentState).build();
}
public OrderFromCartDraftDsl withState(@Nullable final Referenceable state) {
return newBuilder().state(Optional.ofNullable(state).map(Referenceable::toReference).orElse(null)).build();
}
public OrderFromCartDraftDsl withVersion(final Long version) {
return newBuilder().version(version).build();
}
/**
* 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 OrderFromCartDraftDsl of(@Nullable final String id, final Long version,
@Nullable final String orderNumber, @Nullable final PaymentState paymentState) {
return new OrderFromCartDraftDsl(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 OrderFromCartDraftDsl of(@Nullable final String id, final Long version) {
return new OrderFromCartDraftDsl(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 OrderFromCartDraftDsl of(final ResourceIdentifier cart, final Long version,
@Nullable final String orderNumber, @Nullable final PaymentState paymentState) {
return new OrderFromCartDraftDsl(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 OrderFromCartDraftDsl of(final ResourceIdentifier cart, final Long version) {
return new OrderFromCartDraftDsl(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 OrderFromCartDraftDsl of(final OrderFromCartDraft template) {
return new OrderFromCartDraftDsl(template.getCart(), template.getCustom(), template.getId(), template.getOrderNumber(), template.getOrderState(), template.getPaymentState(), template.getShipmentState(), template.getState(), template.getVersion());
}
}