io.sphere.sdk.shippingmethods.CartValueBuilder Maven / Gradle / Ivy
The newest version!
package io.sphere.sdk.shippingmethods;
import io.sphere.sdk.models.Base;
import io.sphere.sdk.models.Builder;
import java.lang.Boolean;
import java.lang.Long;
import java.lang.String;
import javax.annotation.Generated;
import javax.annotation.Nullable;
import javax.money.MonetaryAmount;
/**
* Builder for {@link CartValue}.
*/
@Generated(
value = "io.sphere.sdk.annotations.processors.generators.HasBuilderGenerator",
comments = "Generated from: io.sphere.sdk.shippingmethods.CartValue"
)
public final class CartValueBuilder extends Base implements Builder {
@Nullable
private Boolean matching;
private Long minimumCentAmount;
private MonetaryAmount price;
private String type;
CartValueBuilder() {
}
CartValueBuilder(@Nullable final Boolean matching, final Long minimumCentAmount,
final MonetaryAmount price, final String type) {
this.matching = matching;
this.minimumCentAmount = minimumCentAmount;
this.price = price;
this.type = type;
}
/**
* Sets the {@code matching} property of this builder.
*
* @param matching the value for {@link ShippingRatePriceTier#isMatching()}
* @return this builder
*/
public CartValueBuilder matching(@Nullable final Boolean matching) {
this.matching = matching;
return this;
}
/**
* Sets the {@code matching} property of this builder.
*
* @param matching the value for {@link ShippingRatePriceTier#isMatching()}
* @return this builder
*/
public CartValueBuilder isMatching(@Nullable final Boolean matching) {
this.matching = matching;
return this;
}
/**
* Sets the {@code minimumCentAmount} property of this builder.
*
* @param minimumCentAmount the value for {@link CartValue#getMinimumCentAmount()}
* @return this builder
*/
public CartValueBuilder minimumCentAmount(final Long minimumCentAmount) {
this.minimumCentAmount = minimumCentAmount;
return this;
}
/**
* Sets the {@code price} property of this builder.
*
* @param price the value for {@link ShippingRatePriceTier#getPrice()}
* @return this builder
*/
public CartValueBuilder price(final MonetaryAmount price) {
this.price = price;
return this;
}
/**
* Sets the {@code type} property of this builder.
*
* @param type the value for {@link ShippingRatePriceTier#getType()}
* @return this builder
*/
public CartValueBuilder type(final String type) {
this.type = type;
return this;
}
/**
* Creates a new instance of {@code CartValue} with the values of this builder.
*
* @return the instance
*/
public CartValue build() {
return new CartValueImpl(matching, minimumCentAmount, price, type);
}
/**
* Creates a new object initialized with the given values.
*
* @param minimumCentAmount initial value for the {@link CartValue#getMinimumCentAmount()} property
* @param price initial value for the {@link ShippingRatePriceTier#getPrice()} property
* @return new object initialized with the given values
*/
public static CartValueBuilder of(final Long minimumCentAmount, final MonetaryAmount price) {
return new CartValueBuilder(null, minimumCentAmount, price, 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 CartValueBuilder of(final CartValue template) {
return new CartValueBuilder(template.isMatching(), template.getMinimumCentAmount(), template.getPrice(), template.getType());
}
}