All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.commercetools.importapi.models.common.PriceTierBuilder Maven / Gradle / Ivy

There is a newer version: 17.15.1
Show newest version

package com.commercetools.importapi.models.common;

import java.util.*;
import java.util.function.Function;

import io.vrap.rmf.base.client.Builder;
import io.vrap.rmf.base.client.utils.Generated;

/**
 * PriceTierBuilder
 * 
* Example to create an instance using the builder pattern *
*

 *     PriceTier priceTier = PriceTier.builder()
 *             .minimumQuantity(0.3)
 *             .value(valueBuilder -> valueBuilder)
 *             .build()
 * 
*
*/ @Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") public class PriceTierBuilder implements Builder { private Long minimumQuantity; private com.commercetools.importapi.models.common.TypedMoney value; /** *

The minimum quantity this price tier is valid for.

* @param minimumQuantity value to be set * @return Builder */ public PriceTierBuilder minimumQuantity(final Long minimumQuantity) { this.minimumQuantity = minimumQuantity; return this; } /** *

The currency of a price tier is always the same as the currency of the base Price.

* @param value value to be set * @return Builder */ public PriceTierBuilder value(final com.commercetools.importapi.models.common.TypedMoney value) { this.value = value; return this; } /** *

The currency of a price tier is always the same as the currency of the base Price.

* @param builder function to build the value value * @return Builder */ public PriceTierBuilder value( Function> builder) { this.value = builder.apply(com.commercetools.importapi.models.common.TypedMoneyBuilder.of()).build(); return this; } /** *

The minimum quantity this price tier is valid for.

* @return minimumQuantity */ public Long getMinimumQuantity() { return this.minimumQuantity; } /** *

The currency of a price tier is always the same as the currency of the base Price.

* @return value */ public com.commercetools.importapi.models.common.TypedMoney getValue() { return this.value; } /** * builds PriceTier with checking for non-null required values * @return PriceTier */ public PriceTier build() { Objects.requireNonNull(minimumQuantity, PriceTier.class + ": minimumQuantity is missing"); Objects.requireNonNull(value, PriceTier.class + ": value is missing"); return new PriceTierImpl(minimumQuantity, value); } /** * builds PriceTier without checking for non-null required values * @return PriceTier */ public PriceTier buildUnchecked() { return new PriceTierImpl(minimumQuantity, value); } /** * factory method for an instance of PriceTierBuilder * @return builder */ public static PriceTierBuilder of() { return new PriceTierBuilder(); } /** * create builder for PriceTier instance * @param template instance with prefilled values for the builder * @return builder */ public static PriceTierBuilder of(final PriceTier template) { PriceTierBuilder builder = new PriceTierBuilder(); builder.minimumQuantity = template.getMinimumQuantity(); builder.value = template.getValue(); return builder; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy