io.sphere.sdk.cartdiscounts.CartDiscountDraftDslBase Maven / Gradle / Ivy
The newest version!
package io.sphere.sdk.cartdiscounts;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.sphere.sdk.models.Base;
import io.sphere.sdk.models.LocalizedString;
import io.sphere.sdk.types.CustomFieldsDraft;
import java.lang.Boolean;
import java.lang.String;
import java.lang.SuppressWarnings;
import java.time.ZonedDateTime;
import javax.annotation.Generated;
import javax.annotation.Nullable;
/**
* Abstract base dsl class for {@link CartDiscountDraft} which needs to be extended to add additional methods.
* Subclasses have to provide the same non-default constructor as this class.
*/
@Generated(
value = "io.sphere.sdk.annotations.processors.generators.ResourceDraftValueGenerator",
comments = "Generated from: io.sphere.sdk.cartdiscounts.CartDiscountDraft"
)
abstract class CartDiscountDraftDslBase extends Base implements CartDiscountDraft {
@Nullable
private Boolean active;
private String cartPredicate;
@Nullable
private CustomFieldsDraft custom;
@Nullable
private LocalizedString description;
@Nullable
private String key;
private LocalizedString name;
private Boolean requiresDiscountCode;
private String sortOrder;
@Nullable
private StackingMode stackingMode;
@Nullable
private CartDiscountTarget target;
@Nullable
private ZonedDateTime validFrom;
@Nullable
private ZonedDateTime validUntil;
private CartDiscountValue value;
@JsonCreator
CartDiscountDraftDslBase(@Nullable @JsonProperty("isActive") final Boolean active,
final String cartPredicate, @Nullable final CustomFieldsDraft custom,
@Nullable final LocalizedString description, @Nullable final String key,
final LocalizedString name,
@JsonProperty("requiresDiscountCode") final Boolean requiresDiscountCode,
final String sortOrder, @Nullable final StackingMode stackingMode,
@Nullable final CartDiscountTarget target, @Nullable final ZonedDateTime validFrom,
@Nullable final ZonedDateTime validUntil, final CartDiscountValue value) {
this.active = active;
this.cartPredicate = cartPredicate;
this.custom = custom;
this.description = description;
this.key = key;
this.name = name;
this.requiresDiscountCode = requiresDiscountCode;
this.sortOrder = sortOrder;
this.stackingMode = stackingMode;
this.target = target;
this.validFrom = validFrom;
this.validUntil = validUntil;
this.value = value;
}
@Nullable
@JsonProperty("isActive")
public Boolean isActive() {
return active;
}
public String getCartPredicate() {
return cartPredicate;
}
@Nullable
public CustomFieldsDraft getCustom() {
return custom;
}
@Nullable
public LocalizedString getDescription() {
return description;
}
@Nullable
public String getKey() {
return key;
}
public LocalizedString getName() {
return name;
}
@JsonProperty("requiresDiscountCode")
public Boolean isRequiresDiscountCode() {
return requiresDiscountCode;
}
public String getSortOrder() {
return sortOrder;
}
@Nullable
public StackingMode getStackingMode() {
return stackingMode;
}
@Nullable
public CartDiscountTarget getTarget() {
return target;
}
@Nullable
public ZonedDateTime getValidFrom() {
return validFrom;
}
@Nullable
public ZonedDateTime getValidUntil() {
return validUntil;
}
public CartDiscountValue getValue() {
return value;
}
/**
* Creates a new builder with the values of this object.
*
* @return new builder
*/
public CartDiscountDraftBuilder newBuilder() {
return new CartDiscountDraftBuilder(active, cartPredicate, custom, description, key, name, requiresDiscountCode, sortOrder, stackingMode, target, validFrom, validUntil, value);
}
@SuppressWarnings("unchecked")
public T withActive(@Nullable final Boolean active) {
return (T) newBuilder().active(active).build();
}
@SuppressWarnings("unchecked")
public T withCartPredicate(final String cartPredicate) {
return (T) newBuilder().cartPredicate(cartPredicate).build();
}
@SuppressWarnings("unchecked")
public T withCustom(@Nullable final CustomFieldsDraft custom) {
return (T) newBuilder().custom(custom).build();
}
@SuppressWarnings("unchecked")
public T withDescription(@Nullable final LocalizedString description) {
return (T) newBuilder().description(description).build();
}
@SuppressWarnings("unchecked")
public T withKey(@Nullable final String key) {
return (T) newBuilder().key(key).build();
}
@SuppressWarnings("unchecked")
public T withName(final LocalizedString name) {
return (T) newBuilder().name(name).build();
}
@SuppressWarnings("unchecked")
public T withRequiresDiscountCode(final Boolean requiresDiscountCode) {
return (T) newBuilder().requiresDiscountCode(requiresDiscountCode).build();
}
@SuppressWarnings("unchecked")
public T withSortOrder(final String sortOrder) {
return (T) newBuilder().sortOrder(sortOrder).build();
}
@SuppressWarnings("unchecked")
public T withStackingMode(@Nullable final StackingMode stackingMode) {
return (T) newBuilder().stackingMode(stackingMode).build();
}
@SuppressWarnings("unchecked")
public T withTarget(@Nullable final CartDiscountTarget target) {
return (T) newBuilder().target(target).build();
}
@SuppressWarnings("unchecked")
public T withValidFrom(@Nullable final ZonedDateTime validFrom) {
return (T) newBuilder().validFrom(validFrom).build();
}
@SuppressWarnings("unchecked")
public T withValidUntil(@Nullable final ZonedDateTime validUntil) {
return (T) newBuilder().validUntil(validUntil).build();
}
@SuppressWarnings("unchecked")
public T withValue(final CartDiscountValue value) {
return (T) newBuilder().value(value).build();
}
@SuppressWarnings("unchecked")
public T withIsActive(@Nullable final Boolean active) {
return (T) newBuilder().active(active).build();
}
/**
* Creates a new object initialized with the given values.
*
* @param name initial value for the {@link CartDiscountDraft#getName()} property
* @param cartPredicate initial value for the {@link CartDiscountDraft#getCartPredicate()} property
* @param value initial value for the {@link CartDiscountDraft#getValue()} property
* @param target initial value for the {@link CartDiscountDraft#getTarget()} property
* @param sortOrder initial value for the {@link CartDiscountDraft#getSortOrder()} property
* @param requiresDiscountCode initial value for the {@link CartDiscountDraft#isRequiresDiscountCode()} property
* @return new object initialized with the given values
*/
public static CartDiscountDraftDsl of(final LocalizedString name, final String cartPredicate,
final CartDiscountValue value, @Nullable final CartDiscountTarget target,
final String sortOrder, final boolean requiresDiscountCode) {
return new CartDiscountDraftDsl(null, cartPredicate, null, null, null, name, requiresDiscountCode, sortOrder, null, target, null, null, value);
}
/**
* 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 CartDiscountDraftDsl of(final CartDiscountDraft template) {
return new CartDiscountDraftDsl(template.isActive(), template.getCartPredicate(), template.getCustom(), template.getDescription(), template.getKey(), template.getName(), template.isRequiresDiscountCode(), template.getSortOrder(), template.getStackingMode(), template.getTarget(), template.getValidFrom(), template.getValidUntil(), template.getValue());
}
}