io.sphere.sdk.discountcodes.DiscountCodeDraftDsl 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 com.fasterxml.jackson.annotation.JsonCreator;
import io.sphere.sdk.discountcodes.DiscountCodeDraftBuilder;
public final class DiscountCodeDraftDsl extends io.sphere.sdk.models.Base implements DiscountCodeDraft {
@Nullable()
private final io.sphere.sdk.models.LocalizedString name;
@Nullable()
private final io.sphere.sdk.models.LocalizedString description;
private final java.lang.String code;
private final java.util.List> cartDiscounts;
@Nullable()
private final java.lang.String cartPredicate;
@JsonProperty("isActive")
private final java.lang.Boolean active;
@Nullable()
private final java.lang.Long maxApplications;
@Nullable()
private final java.lang.Long maxApplicationsPerCustomer;
@JsonCreator()
DiscountCodeDraftDsl(@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;
}
@JsonProperty("isActive")
public java.lang.Boolean isActive() {
return active;
}
public java.util.List> getCartDiscounts() {
return cartDiscounts;
}
@Nullable()
public java.lang.String getCartPredicate() {
return cartPredicate;
}
public java.lang.String getCode() {
return code;
}
@Nullable()
public io.sphere.sdk.models.LocalizedString getDescription() {
return description;
}
@Nullable()
public java.lang.Long getMaxApplications() {
return maxApplications;
}
@Nullable()
public java.lang.Long getMaxApplicationsPerCustomer() {
return maxApplicationsPerCustomer;
}
@Nullable()
public io.sphere.sdk.models.LocalizedString getName() {
return name;
}
public DiscountCodeDraftDsl withName(@Nullable() final io.sphere.sdk.models.LocalizedString name) {
return newBuilder().name(name).build();
}
public DiscountCodeDraftDsl withDescription(@Nullable() final io.sphere.sdk.models.LocalizedString description) {
return newBuilder().description(description).build();
}
public DiscountCodeDraftDsl withCode(final java.lang.String code) {
return newBuilder().code(code).build();
}
public DiscountCodeDraftDsl withCartDiscounts(final java.util.List> cartDiscounts) {
return newBuilder().cartDiscounts(cartDiscounts).build();
}
public DiscountCodeDraftDsl withCartPredicate(@Nullable() final java.lang.String cartPredicate) {
return newBuilder().cartPredicate(cartPredicate).build();
}
public DiscountCodeDraftDsl withActive(final java.lang.Boolean active) {
return newBuilder().active(active).build();
}
public DiscountCodeDraftDsl withIsActive(final java.lang.Boolean active) {
return newBuilder().active(active).build();
}
public DiscountCodeDraftDsl withMaxApplications(@Nullable() final java.lang.Long maxApplications) {
return newBuilder().maxApplications(maxApplications).build();
}
public DiscountCodeDraftDsl withMaxApplicationsPerCustomer(@Nullable() final java.lang.Long maxApplicationsPerCustomer) {
return newBuilder().maxApplicationsPerCustomer(maxApplicationsPerCustomer).build();
}
private DiscountCodeDraftBuilder newBuilder() {
return new DiscountCodeDraftBuilder(active, cartDiscounts, cartPredicate, code, description, maxApplications, maxApplicationsPerCustomer, name);
}
public static DiscountCodeDraftDsl of(final java.lang.String code, final java.util.List> cartDiscounts) {
return new DiscountCodeDraftDsl(null, cartDiscounts, null, code, null, null, null, null);
}
public static DiscountCodeDraftDsl of(final DiscountCodeDraft template) {
return new DiscountCodeDraftDsl(template.isActive(), template.getCartDiscounts(), template.getCartPredicate(), template.getCode(), template.getDescription(), template.getMaxApplications(), template.getMaxApplicationsPerCustomer(), template.getName());
}
public DiscountCodeDraftDsl withCartDiscounts(final Referenceable cartDiscount) {
return withCartDiscounts(Collections.singletonList(cartDiscount.toReference()));
}
public static DiscountCodeDraftDsl of(final String code, final Referenceable cartDiscount) {
return of(code, Collections.singletonList(cartDiscount.toReference()));
}
public DiscountCodeDraftDsl withCartPredicate(@Nullable final io.sphere.sdk.cartdiscounts.CartDiscountPredicate cartPredicate) {
return newBuilder().cartPredicate(cartPredicate.toSphereCartPredicate()).build();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy