io.sphere.sdk.orders.OrderFromCartDraftDsl Maven / Gradle / Ivy
package io.sphere.sdk.orders;
import com.fasterxml.jackson.annotation.JsonCreator;
import io.sphere.sdk.models.Base;
import io.sphere.sdk.models.Reference;
import io.sphere.sdk.models.Referenceable;
import io.sphere.sdk.states.State;
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 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 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.id = id;
this.orderNumber = orderNumber;
this.orderState = orderState;
this.paymentState = paymentState;
this.shipmentState = shipmentState;
this.state = state;
this.version = version;
}
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(id, orderNumber, orderState, paymentState, shipmentState, state, version);
}
public OrderFromCartDraftDsl withId(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(final String id, final Long version,
@Nullable final String orderNumber, @Nullable final PaymentState paymentState) {
return new OrderFromCartDraftDsl(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(final String id, final Long version) {
return new OrderFromCartDraftDsl(id, 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.getId(), template.getOrderNumber(), template.getOrderState(), template.getPaymentState(), template.getShipmentState(), template.getState(), template.getVersion());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy