io.sphere.sdk.cartdiscounts.CartDiscountDraftBuilderBase Maven / Gradle / Ivy
package io.sphere.sdk.cartdiscounts;
import io.sphere.sdk.models.Base;
import io.sphere.sdk.models.Builder;
import io.sphere.sdk.models.LocalizedString;
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 {
Boolean active;
String cartPredicate;
@Nullable
LocalizedString description;
LocalizedString name;
Boolean requiresDiscountCode;
String sortOrder;
CartDiscountTarget target;
@Nullable
ZonedDateTime validFrom;
@Nullable
ZonedDateTime validUntil;
CartDiscountValue value;
protected CartDiscountDraftBuilderBase() {
}
protected CartDiscountDraftBuilderBase(final Boolean active, final String cartPredicate,
@Nullable final LocalizedString description, final LocalizedString name,
final Boolean requiresDiscountCode, final String sortOrder, final CartDiscountTarget target,
@Nullable final ZonedDateTime validFrom, @Nullable final ZonedDateTime validUntil,
final CartDiscountValue value) {
this.active = active;
this.cartPredicate = cartPredicate;
this.description = description;
this.name = name;
this.requiresDiscountCode = requiresDiscountCode;
this.sortOrder = sortOrder;
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(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(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 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 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 target} property of this builder.
*
* @param target the value for {@link CartDiscountDraft#getTarget()}
* @return this builder
*/
@SuppressWarnings("unchecked")
public T target(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;
}
/**
* Creates a new instance of {@code CartDiscountDraftDsl} with the values of this builder.
*
* @return the instance
*/
public CartDiscountDraftDsl build() {
return new CartDiscountDraftDsl(active, cartPredicate, description, name, requiresDiscountCode, sortOrder, target, validFrom, validUntil, value);
}
/**
* Creates a builder 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 builder initialized with the given values
*/
public static CartDiscountDraftBuilder of(final LocalizedString name, final String cartPredicate,
final CartDiscountValue value, final CartDiscountTarget target, final String sortOrder,
final boolean requiresDiscountCode) {
return new CartDiscountDraftBuilder(null, cartPredicate, null, name, requiresDiscountCode, sortOrder, target, null, null, value);
}
/**
* Creates a builder initialized with the fields of the template parameter.
*
* @param template the template
* @return a new builder initialized from the template
*/
public static CartDiscountDraftBuilder of(final CartDiscountDraft template) {
return new CartDiscountDraftBuilder(template.isActive(), template.getCartPredicate(), template.getDescription(), template.getName(), template.isRequiresDiscountCode(), template.getSortOrder(), template.getTarget(), template.getValidFrom(), template.getValidUntil(), template.getValue());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy