io.sphere.sdk.cartdiscounts.CartDiscountDraftBuilderBase Maven / Gradle / Ivy
The newest version!
package io.sphere.sdk.cartdiscounts;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.sphere.sdk.models.Base;
import io.sphere.sdk.models.Builder;
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 builder 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.DraftBuilderGenerator",
comments = "Generated from: io.sphere.sdk.cartdiscounts.CartDiscountDraft"
)
abstract class CartDiscountDraftBuilderBase extends Base implements Builder {
@Nullable
Boolean active;
String cartPredicate;
@Nullable
CustomFieldsDraft custom;
@Nullable
LocalizedString description;
@Nullable
String key;
LocalizedString name;
Boolean requiresDiscountCode;
String sortOrder;
@Nullable
StackingMode stackingMode;
@Nullable
CartDiscountTarget target;
@Nullable
ZonedDateTime validFrom;
@Nullable
ZonedDateTime validUntil;
CartDiscountValue value;
protected CartDiscountDraftBuilderBase() {
}
protected CartDiscountDraftBuilderBase(@Nullable final Boolean active, final String cartPredicate,
@Nullable final CustomFieldsDraft custom, @Nullable final LocalizedString description,
@Nullable final String key, final LocalizedString name, 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;
}
/**
* Sets the {@code active} property of this builder.
*
* @param active the value for {@link CartDiscountDraft#isActive()}
* @return this builder
*/
@SuppressWarnings("unchecked")
public T active(@Nullable final Boolean active) {
this.active = active;
return (T) this;
}
/**
* Sets the {@code active} property of this builder.
*
* @param active the value for {@link CartDiscountDraft#isActive()}
* @return this builder
*/
@SuppressWarnings("unchecked")
public T isActive(@Nullable final Boolean active) {
this.active = active;
return (T) this;
}
/**
* Sets the {@code cartPredicate} property of this builder.
*
* @param cartPredicate the value for {@link CartDiscountDraft#getCartPredicate()}
* @return this builder
*/
@SuppressWarnings("unchecked")
public T cartPredicate(final String cartPredicate) {
this.cartPredicate = cartPredicate;
return (T) this;
}
/**
* Sets the {@code custom} property of this builder.
*
* @param custom the value for {@link CartDiscountDraft#getCustom()}
* @return this builder
*/
@SuppressWarnings("unchecked")
public T custom(@Nullable final CustomFieldsDraft custom) {
this.custom = custom;
return (T) this;
}
/**
* Sets the {@code description} property of this builder.
*
* @param description the value for {@link CartDiscountDraft#getDescription()}
* @return this builder
*/
@SuppressWarnings("unchecked")
public T description(@Nullable final LocalizedString description) {
this.description = description;
return (T) this;
}
/**
* Sets the {@code key} property of this builder.
*
* @param key the value for {@link CartDiscountDraft#getKey()}
* @return this builder
*/
@SuppressWarnings("unchecked")
public T key(@Nullable final String key) {
this.key = key;
return (T) this;
}
/**
* Sets the {@code name} property of this builder.
*
* @param name the value for {@link CartDiscountDraft#getName()}
* @return this builder
*/
@SuppressWarnings("unchecked")
public T name(final LocalizedString name) {
this.name = name;
return (T) this;
}
/**
* Sets the {@code requiresDiscountCode} property of this builder.
*
* @param requiresDiscountCode the value for {@link CartDiscountDraft#isRequiresDiscountCode()}
* @return this builder
*/
@SuppressWarnings("unchecked")
public T requiresDiscountCode(final Boolean requiresDiscountCode) {
this.requiresDiscountCode = requiresDiscountCode;
return (T) this;
}
/**
* Sets the {@code requiresDiscountCode} property of this builder.
*
* @param requiresDiscountCode the value for {@link CartDiscountDraft#isRequiresDiscountCode()}
* @return this builder
*/
@SuppressWarnings("unchecked")
public T isRequiresDiscountCode(final Boolean requiresDiscountCode) {
this.requiresDiscountCode = requiresDiscountCode;
return (T) this;
}
/**
* Sets the {@code sortOrder} property of this builder.
*
* @param sortOrder the value for {@link CartDiscountDraft#getSortOrder()}
* @return this builder
*/
@SuppressWarnings("unchecked")
public T sortOrder(final String sortOrder) {
this.sortOrder = sortOrder;
return (T) this;
}
/**
* Sets the {@code stackingMode} property of this builder.
*
* @param stackingMode the value for {@link CartDiscountDraft#getStackingMode()}
* @return this builder
*/
@SuppressWarnings("unchecked")
public T stackingMode(@Nullable final StackingMode stackingMode) {
this.stackingMode = stackingMode;
return (T) this;
}
/**
* Sets the {@code target} property of this builder.
*
* @param target the value for {@link CartDiscountDraft#getTarget()}
* @return this builder
*/
@SuppressWarnings("unchecked")
public T target(@Nullable final CartDiscountTarget target) {
this.target = target;
return (T) this;
}
/**
* Sets the {@code validFrom} property of this builder.
*
* @param validFrom the value for {@link CartDiscountDraft#getValidFrom()}
* @return this builder
*/
@SuppressWarnings("unchecked")
public T validFrom(@Nullable final ZonedDateTime validFrom) {
this.validFrom = validFrom;
return (T) this;
}
/**
* Sets the {@code validUntil} property of this builder.
*
* @param validUntil the value for {@link CartDiscountDraft#getValidUntil()}
* @return this builder
*/
@SuppressWarnings("unchecked")
public T validUntil(@Nullable final ZonedDateTime validUntil) {
this.validUntil = validUntil;
return (T) this;
}
/**
* Sets the {@code value} property of this builder.
*
* @param value the value for {@link CartDiscountDraft#getValue()}
* @return this builder
*/
@SuppressWarnings("unchecked")
public T value(final CartDiscountValue value) {
this.value = value;
return (T) this;
}
@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 instance of {@code CartDiscountDraftDsl} with the values of this builder.
*
* @return the instance
*/
public CartDiscountDraftDsl build() {
return new CartDiscountDraftDsl(active, cartPredicate, custom, description, key, name, requiresDiscountCode, sortOrder, stackingMode, target, validFrom, validUntil, value);
}
/**
* 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 CartDiscountDraftBuilder of(final LocalizedString name, final String cartPredicate,
final CartDiscountValue value, @Nullable final CartDiscountTarget target,
final String sortOrder, final boolean requiresDiscountCode) {
return new CartDiscountDraftBuilder(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 CartDiscountDraftBuilder of(final CartDiscountDraft template) {
return new CartDiscountDraftBuilder(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());
}
}