io.sphere.sdk.discountcodes.DiscountCodeDraftBuilder Maven / Gradle / Ivy
/*
This class has been generated by class io.sphere.sdk.annotations.processors.ResourceDraftValueAnnotationProcessor
induced by the annotation io.sphere.sdk.annotations.ResourceDraftValue.
in the source class io.sphere.sdk.discountcodes.DiscountCodeDraft.
*/
package io.sphere.sdk.discountcodes;
import javax.annotation.Nullable;
import io.sphere.sdk.models.*;
import java.util.*;
import io.sphere.sdk.utils.*;
import com.fasterxml.jackson.annotation.*;
import io.sphere.sdk.models.Builder;
import com.fasterxml.jackson.annotation.JsonCreator;
/** Builder for {@link DiscountCodeDraft}. */
public final class DiscountCodeDraftBuilder extends io.sphere.sdk.models.Base implements Builder {
@Nullable()
private io.sphere.sdk.models.LocalizedString name;
@Nullable()
private io.sphere.sdk.models.LocalizedString description;
private java.lang.String code;
private java.util.List> cartDiscounts;
@Nullable()
private java.lang.String cartPredicate;
@JsonProperty("isActive")
private java.lang.Boolean active;
@Nullable()
private java.lang.Long maxApplications;
@Nullable()
private java.lang.Long maxApplicationsPerCustomer;
@JsonCreator()
DiscountCodeDraftBuilder(@com.fasterxml.jackson.annotation.JsonProperty("isActive") final java.lang.Boolean active, final java.util.List> cartDiscounts, final java.lang.String cartPredicate, final java.lang.String code, final io.sphere.sdk.models.LocalizedString description, final java.lang.Long maxApplications, final java.lang.Long maxApplicationsPerCustomer, final io.sphere.sdk.models.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;
}
public DiscountCodeDraftBuilder name(@Nullable() final io.sphere.sdk.models.LocalizedString name) {
this.name = name;
return this;
}
public DiscountCodeDraftBuilder description(@Nullable() final io.sphere.sdk.models.LocalizedString description) {
this.description = description;
return this;
}
public DiscountCodeDraftBuilder code(final java.lang.String code) {
this.code = code;
return this;
}
public DiscountCodeDraftBuilder cartDiscounts(final java.util.List> cartDiscounts) {
this.cartDiscounts = cartDiscounts;
return this;
}
public DiscountCodeDraftBuilder cartPredicate(@Nullable() final java.lang.String cartPredicate) {
this.cartPredicate = cartPredicate;
return this;
}
public DiscountCodeDraftBuilder active(final java.lang.Boolean active) {
this.active = active;
return this;
}
public DiscountCodeDraftBuilder isActive(final java.lang.Boolean active) {
this.active = active;
return this;
}
public DiscountCodeDraftBuilder maxApplications(@Nullable() final java.lang.Long maxApplications) {
this.maxApplications = maxApplications;
return this;
}
public DiscountCodeDraftBuilder maxApplicationsPerCustomer(@Nullable() final java.lang.Long maxApplicationsPerCustomer) {
this.maxApplicationsPerCustomer = maxApplicationsPerCustomer;
return this;
}
public DiscountCodeDraftDsl build() {
return new DiscountCodeDraftDsl(active, cartDiscounts, cartPredicate, code, description, maxApplications, maxApplicationsPerCustomer, name);
}
public static DiscountCodeDraftBuilder of(final java.lang.String code, final java.util.List> cartDiscounts) {
return new DiscountCodeDraftBuilder(null, cartDiscounts, null, code, null, null, null, null);
}
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());
}
public DiscountCodeDraftBuilder cartPredicate(@Nullable final io.sphere.sdk.cartdiscounts.CartDiscountPredicate cartPredicate) {
return cartPredicate(cartPredicate.toSphereCartPredicate());
}
public DiscountCodeDraftBuilder isActive(final boolean active) {
this.active = active;
return this;
}
public static DiscountCodeDraftBuilder of(final java.lang.String code, final io.sphere.sdk.models.Referenceable cartDiscount) {
return of(code, Collections.singletonList(cartDiscount.toReference()));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy