io.sphere.sdk.discountcodes.DiscountCodeDraftDslBase Maven / Gradle / Ivy
package io.sphere.sdk.discountcodes;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.sphere.sdk.cartdiscounts.CartDiscount;
import io.sphere.sdk.models.Base;
import io.sphere.sdk.models.LocalizedString;
import io.sphere.sdk.models.Reference;
import io.sphere.sdk.types.CustomFieldsDraft;
import java.lang.Boolean;
import java.lang.Long;
import java.lang.String;
import java.lang.SuppressWarnings;
import java.time.ZonedDateTime;
import java.util.List;
import javax.annotation.Generated;
import javax.annotation.Nullable;
/**
* Abstract base dsl class 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.ResourceDraftValueGenerator",
comments = "Generated from: io.sphere.sdk.discountcodes.DiscountCodeDraft"
)
abstract class DiscountCodeDraftDslBase extends Base implements DiscountCodeDraft {
private Boolean active;
private List> cartDiscounts;
@Nullable
private String cartPredicate;
private String code;
@Nullable
private CustomFieldsDraft custom;
@Nullable
private LocalizedString description;
@Nullable
private List groups;
@Nullable
private Long maxApplications;
@Nullable
private Long maxApplicationsPerCustomer;
@Nullable
private LocalizedString name;
@Nullable
private ZonedDateTime validFrom;
@Nullable
private ZonedDateTime validUntil;
@JsonCreator
DiscountCodeDraftDslBase(@JsonProperty("isActive") final Boolean active,
final List> cartDiscounts, @Nullable final String cartPredicate,
final String code, @Nullable final CustomFieldsDraft custom,
@Nullable final LocalizedString description, @Nullable final List groups,
@Nullable final Long maxApplications, @Nullable final Long maxApplicationsPerCustomer,
@Nullable final LocalizedString name, @Nullable final ZonedDateTime validFrom,
@Nullable final ZonedDateTime validUntil) {
this.active = active;
this.cartDiscounts = cartDiscounts;
this.cartPredicate = cartPredicate;
this.code = code;
this.custom = custom;
this.description = description;
this.groups = groups;
this.maxApplications = maxApplications;
this.maxApplicationsPerCustomer = maxApplicationsPerCustomer;
this.name = name;
this.validFrom = validFrom;
this.validUntil = validUntil;
}
@JsonProperty("isActive")
public Boolean isActive() {
return active;
}
public List> getCartDiscounts() {
return cartDiscounts;
}
@Nullable
public String getCartPredicate() {
return cartPredicate;
}
public String getCode() {
return code;
}
@Nullable
public CustomFieldsDraft getCustom() {
return custom;
}
@Nullable
public LocalizedString getDescription() {
return description;
}
@Nullable
public List getGroups() {
return groups;
}
@Nullable
public Long getMaxApplications() {
return maxApplications;
}
@Nullable
public Long getMaxApplicationsPerCustomer() {
return maxApplicationsPerCustomer;
}
@Nullable
public LocalizedString getName() {
return name;
}
@Nullable
public ZonedDateTime getValidFrom() {
return validFrom;
}
@Nullable
public ZonedDateTime getValidUntil() {
return validUntil;
}
/**
* Creates a new builder with the values of this object.
*
* @return new builder
*/
public DiscountCodeDraftBuilder newBuilder() {
return new DiscountCodeDraftBuilder(active, cartDiscounts, cartPredicate, code, custom, description, groups, maxApplications, maxApplicationsPerCustomer, name, validFrom, validUntil);
}
@SuppressWarnings("unchecked")
public T withActive(final Boolean active) {
return (T) newBuilder().active(active).build();
}
@SuppressWarnings("unchecked")
public T withCartDiscounts(final List> cartDiscounts) {
return (T) newBuilder().cartDiscounts(cartDiscounts).build();
}
@SuppressWarnings("unchecked")
public T withCartPredicate(@Nullable final String cartPredicate) {
return (T) newBuilder().cartPredicate(cartPredicate).build();
}
@SuppressWarnings("unchecked")
public T withCode(final String code) {
return (T) newBuilder().code(code).build();
}
@SuppressWarnings("unchecked")
public T withCustom(@Nullable final CustomFieldsDraft custom) {
return (T) newBuilder().custom(custom).build();
}
@SuppressWarnings("unchecked")
public T withDescription(@Nullable final LocalizedString description) {
return (T) newBuilder().description(description).build();
}
@SuppressWarnings("unchecked")
public T withGroups(@Nullable final List groups) {
return (T) newBuilder().groups(groups).build();
}
@SuppressWarnings("unchecked")
public T withMaxApplications(@Nullable final Long maxApplications) {
return (T) newBuilder().maxApplications(maxApplications).build();
}
@SuppressWarnings("unchecked")
public T withMaxApplicationsPerCustomer(@Nullable final Long maxApplicationsPerCustomer) {
return (T) newBuilder().maxApplicationsPerCustomer(maxApplicationsPerCustomer).build();
}
@SuppressWarnings("unchecked")
public T withName(@Nullable final LocalizedString name) {
return (T) newBuilder().name(name).build();
}
@SuppressWarnings("unchecked")
public T withValidFrom(@Nullable final ZonedDateTime validFrom) {
return (T) newBuilder().validFrom(validFrom).build();
}
@SuppressWarnings("unchecked")
public T withValidUntil(@Nullable final ZonedDateTime validUntil) {
return (T) newBuilder().validUntil(validUntil).build();
}
@SuppressWarnings("unchecked")
public T withIsActive(final Boolean active) {
return (T) newBuilder().active(active).build();
}
/**
* Creates a new object 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 object initialized with the given values
*/
public static DiscountCodeDraftDsl of(final String code,
final List> cartDiscounts) {
return new DiscountCodeDraftDsl(null, cartDiscounts, null, code, null, null, null, null, null, null, null, null);
}
/**
* 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 DiscountCodeDraftDsl of(final DiscountCodeDraft template) {
return new DiscountCodeDraftDsl(template.isActive(), template.getCartDiscounts(), template.getCartPredicate(), template.getCode(), template.getCustom(), template.getDescription(), template.getGroups(), template.getMaxApplications(), template.getMaxApplicationsPerCustomer(), template.getName(), template.getValidFrom(), template.getValidUntil());
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy