io.sphere.sdk.discountcodes.DiscountCodeDraftBuilderBase Maven / Gradle / Ivy
package io.sphere.sdk.discountcodes;
import io.sphere.sdk.cartdiscounts.CartDiscount;
import io.sphere.sdk.models.Base;
import io.sphere.sdk.models.Builder;
import io.sphere.sdk.models.LocalizedString;
import io.sphere.sdk.models.Reference;
import java.lang.Boolean;
import java.lang.Long;
import java.lang.String;
import java.lang.SuppressWarnings;
import java.util.List;
import javax.annotation.Generated;
import javax.annotation.Nullable;
/**
* Abstract base builder for {@link DiscountCodeDraft} 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.discountcodes.DiscountCodeDraft"
)
abstract class DiscountCodeDraftBuilderBase extends Base implements Builder {
Boolean active;
List> cartDiscounts;
@Nullable
String cartPredicate;
String code;
@Nullable
LocalizedString description;
@Nullable
Long maxApplications;
@Nullable
Long maxApplicationsPerCustomer;
@Nullable
LocalizedString name;
protected DiscountCodeDraftBuilderBase() {
}
protected DiscountCodeDraftBuilderBase(final Boolean active,
final List> cartDiscounts, @Nullable final String cartPredicate,
final String code, @Nullable final LocalizedString description,
@Nullable final Long maxApplications, @Nullable final Long maxApplicationsPerCustomer,
@Nullable final LocalizedString name) {
this.active = active;
this.cartDiscounts = cartDiscounts;
this.cartPredicate = cartPredicate;
this.code = code;
this.description = description;
this.maxApplications = maxApplications;
this.maxApplicationsPerCustomer = maxApplicationsPerCustomer;
this.name = name;
}
/**
* Sets the {@code active} property of this builder.
*
* @param active the value for {@link DiscountCodeDraft#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 DiscountCodeDraft#isActive()}
* @return this builder
*/
@SuppressWarnings("unchecked")
public T isActive(final Boolean active) {
this.active = active;
return (T) this;
}
/**
* Sets the {@code cartDiscounts} property of this builder.
*
* @param cartDiscounts the value for {@link DiscountCodeDraft#getCartDiscounts()}
* @return this builder
*/
@SuppressWarnings("unchecked")
public T cartDiscounts(final List> cartDiscounts) {
this.cartDiscounts = cartDiscounts;
return (T) this;
}
/**
* Sets the {@code cartPredicate} property of this builder.
*
* @param cartPredicate the value for {@link DiscountCodeDraft#getCartPredicate()}
* @return this builder
*/
@SuppressWarnings("unchecked")
public T cartPredicate(@Nullable final String cartPredicate) {
this.cartPredicate = cartPredicate;
return (T) this;
}
/**
* Sets the {@code code} property of this builder.
*
* @param code the value for {@link DiscountCodeDraft#getCode()}
* @return this builder
*/
@SuppressWarnings("unchecked")
public T code(final String code) {
this.code = code;
return (T) this;
}
/**
* Sets the {@code description} property of this builder.
*
* @param description the value for {@link DiscountCodeDraft#getDescription()}
* @return this builder
*/
@SuppressWarnings("unchecked")
public T description(@Nullable final LocalizedString description) {
this.description = description;
return (T) this;
}
/**
* Sets the {@code maxApplications} property of this builder.
*
* @param maxApplications the value for {@link DiscountCodeDraft#getMaxApplications()}
* @return this builder
*/
@SuppressWarnings("unchecked")
public T maxApplications(@Nullable final Long maxApplications) {
this.maxApplications = maxApplications;
return (T) this;
}
/**
* Sets the {@code maxApplicationsPerCustomer} property of this builder.
*
* @param maxApplicationsPerCustomer the value for {@link DiscountCodeDraft#getMaxApplicationsPerCustomer()}
* @return this builder
*/
@SuppressWarnings("unchecked")
public T maxApplicationsPerCustomer(@Nullable final Long maxApplicationsPerCustomer) {
this.maxApplicationsPerCustomer = maxApplicationsPerCustomer;
return (T) this;
}
/**
* Sets the {@code name} property of this builder.
*
* @param name the value for {@link DiscountCodeDraft#getName()}
* @return this builder
*/
@SuppressWarnings("unchecked")
public T name(@Nullable final LocalizedString name) {
this.name = name;
return (T) this;
}
/**
* Creates a new instance of {@code DiscountCodeDraftDsl} with the values of this builder.
*
* @return the instance
*/
public DiscountCodeDraftDsl build() {
return new DiscountCodeDraftDsl(active, cartDiscounts, cartPredicate, code, description, maxApplications, maxApplicationsPerCustomer, name);
}
/**
* Creates a builder initialized with the given values.
*
* @param code initial value for the {@link DiscountCodeDraft#getCode()} property
* @param cartDiscounts initial value for the {@link DiscountCodeDraft#getCartDiscounts()} property
* @return new builder initialized with the given values
*/
public static DiscountCodeDraftBuilder of(final String code,
final List> cartDiscounts) {
return new DiscountCodeDraftBuilder(null, cartDiscounts, null, code, null, null, null, null);
}
/**
* 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 DiscountCodeDraftBuilder of(final DiscountCodeDraft template) {
return new DiscountCodeDraftBuilder(template.isActive(), template.getCartDiscounts(), template.getCartPredicate(), template.getCode(), template.getDescription(), template.getMaxApplications(), template.getMaxApplicationsPerCustomer(), template.getName());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy