
com.commercetools.importapi.models.orders.DiscountCodeInfoBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of commercetools-sdk-java-importapi Show documentation
Show all versions of commercetools-sdk-java-importapi Show documentation
The e-commerce SDK from commercetools for Java
package com.commercetools.importapi.models.orders;
import java.util.*;
import java.util.function.Function;
import javax.annotation.Nullable;
import io.vrap.rmf.base.client.Builder;
import io.vrap.rmf.base.client.utils.Generated;
/**
* DiscountCodeInfoBuilder
*
* Example to create an instance using the builder pattern
*
*
* DiscountCodeInfo discountCodeInfo = DiscountCodeInfo.builder()
* .discountCode(discountCodeBuilder -> discountCodeBuilder)
* .build()
*
*
*/
@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
public class DiscountCodeInfoBuilder implements Builder {
private com.commercetools.importapi.models.common.DiscountCodeKeyReference discountCode;
@Nullable
private com.commercetools.importapi.models.orders.DiscountCodeState state;
/**
* References a discount code by key.
* @param builder function to build the discountCode value
* @return Builder
*/
public DiscountCodeInfoBuilder discountCode(
Function builder) {
this.discountCode = builder
.apply(com.commercetools.importapi.models.common.DiscountCodeKeyReferenceBuilder.of())
.build();
return this;
}
/**
* References a discount code by key.
* @param builder function to build the discountCode value
* @return Builder
*/
public DiscountCodeInfoBuilder withDiscountCode(
Function builder) {
this.discountCode = builder
.apply(com.commercetools.importapi.models.common.DiscountCodeKeyReferenceBuilder.of());
return this;
}
/**
* References a discount code by key.
* @param discountCode value to be set
* @return Builder
*/
public DiscountCodeInfoBuilder discountCode(
final com.commercetools.importapi.models.common.DiscountCodeKeyReference discountCode) {
this.discountCode = discountCode;
return this;
}
/**
* Maps to DiscountCodeInfo.state
* @param state value to be set
* @return Builder
*/
public DiscountCodeInfoBuilder state(
@Nullable final com.commercetools.importapi.models.orders.DiscountCodeState state) {
this.state = state;
return this;
}
/**
* References a discount code by key.
* @return discountCode
*/
public com.commercetools.importapi.models.common.DiscountCodeKeyReference getDiscountCode() {
return this.discountCode;
}
/**
* Maps to DiscountCodeInfo.state
* @return state
*/
@Nullable
public com.commercetools.importapi.models.orders.DiscountCodeState getState() {
return this.state;
}
/**
* builds DiscountCodeInfo with checking for non-null required values
* @return DiscountCodeInfo
*/
public DiscountCodeInfo build() {
Objects.requireNonNull(discountCode, DiscountCodeInfo.class + ": discountCode is missing");
return new DiscountCodeInfoImpl(discountCode, state);
}
/**
* builds DiscountCodeInfo without checking for non-null required values
* @return DiscountCodeInfo
*/
public DiscountCodeInfo buildUnchecked() {
return new DiscountCodeInfoImpl(discountCode, state);
}
/**
* factory method for an instance of DiscountCodeInfoBuilder
* @return builder
*/
public static DiscountCodeInfoBuilder of() {
return new DiscountCodeInfoBuilder();
}
/**
* create builder for DiscountCodeInfo instance
* @param template instance with prefilled values for the builder
* @return builder
*/
public static DiscountCodeInfoBuilder of(final DiscountCodeInfo template) {
DiscountCodeInfoBuilder builder = new DiscountCodeInfoBuilder();
builder.discountCode = template.getDiscountCode();
builder.state = template.getState();
return builder;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy