001 002package com.commercetools.history.models.change_value; 003 004import java.util.*; 005import java.util.function.Function; 006 007import io.vrap.rmf.base.client.Builder; 008import io.vrap.rmf.base.client.utils.Generated; 009 010/** 011 * ShippingMethodTaxAmountChangeValueBuilder 012 * <hr> 013 * Example to create an instance using the builder pattern 014 * <div class=code-example> 015 * <pre><code class='java'> 016 * ShippingMethodTaxAmountChangeValue shippingMethodTaxAmountChangeValue = ShippingMethodTaxAmountChangeValue.builder() 017 * .taxedPrice(taxedPriceBuilder -> taxedPriceBuilder) 018 * .taxRate(taxRateBuilder -> taxRateBuilder) 019 * .build() 020 * </code></pre> 021 * </div> 022 */ 023@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 024public class ShippingMethodTaxAmountChangeValueBuilder implements Builder<ShippingMethodTaxAmountChangeValue> { 025 026 private com.commercetools.history.models.common.TaxedPrice taxedPrice; 027 028 private com.commercetools.history.models.common.TaxRate taxRate; 029 030 /** 031 * <p>Taxed price for the Shipping Method based on <code>taxRate</code>.</p> 032 * @param builder function to build the taxedPrice value 033 * @return Builder 034 */ 035 036 public ShippingMethodTaxAmountChangeValueBuilder taxedPrice( 037 Function<com.commercetools.history.models.common.TaxedPriceBuilder, com.commercetools.history.models.common.TaxedPriceBuilder> builder) { 038 this.taxedPrice = builder.apply(com.commercetools.history.models.common.TaxedPriceBuilder.of()).build(); 039 return this; 040 } 041 042 /** 043 * <p>Taxed price for the Shipping Method based on <code>taxRate</code>.</p> 044 * @param builder function to build the taxedPrice value 045 * @return Builder 046 */ 047 048 public ShippingMethodTaxAmountChangeValueBuilder withTaxedPrice( 049 Function<com.commercetools.history.models.common.TaxedPriceBuilder, com.commercetools.history.models.common.TaxedPrice> builder) { 050 this.taxedPrice = builder.apply(com.commercetools.history.models.common.TaxedPriceBuilder.of()); 051 return this; 052 } 053 054 /** 055 * <p>Taxed price for the Shipping Method based on <code>taxRate</code>.</p> 056 * @param taxedPrice value to be set 057 * @return Builder 058 */ 059 060 public ShippingMethodTaxAmountChangeValueBuilder taxedPrice( 061 final com.commercetools.history.models.common.TaxedPrice taxedPrice) { 062 this.taxedPrice = taxedPrice; 063 return this; 064 } 065 066 /** 067 * <p>Tax rate set externally for the Shipping Method.</p> 068 * @param builder function to build the taxRate value 069 * @return Builder 070 */ 071 072 public ShippingMethodTaxAmountChangeValueBuilder taxRate( 073 Function<com.commercetools.history.models.common.TaxRateBuilder, com.commercetools.history.models.common.TaxRateBuilder> builder) { 074 this.taxRate = builder.apply(com.commercetools.history.models.common.TaxRateBuilder.of()).build(); 075 return this; 076 } 077 078 /** 079 * <p>Tax rate set externally for the Shipping Method.</p> 080 * @param builder function to build the taxRate value 081 * @return Builder 082 */ 083 084 public ShippingMethodTaxAmountChangeValueBuilder withTaxRate( 085 Function<com.commercetools.history.models.common.TaxRateBuilder, com.commercetools.history.models.common.TaxRate> builder) { 086 this.taxRate = builder.apply(com.commercetools.history.models.common.TaxRateBuilder.of()); 087 return this; 088 } 089 090 /** 091 * <p>Tax rate set externally for the Shipping Method.</p> 092 * @param taxRate value to be set 093 * @return Builder 094 */ 095 096 public ShippingMethodTaxAmountChangeValueBuilder taxRate( 097 final com.commercetools.history.models.common.TaxRate taxRate) { 098 this.taxRate = taxRate; 099 return this; 100 } 101 102 /** 103 * <p>Taxed price for the Shipping Method based on <code>taxRate</code>.</p> 104 * @return taxedPrice 105 */ 106 107 public com.commercetools.history.models.common.TaxedPrice getTaxedPrice() { 108 return this.taxedPrice; 109 } 110 111 /** 112 * <p>Tax rate set externally for the Shipping Method.</p> 113 * @return taxRate 114 */ 115 116 public com.commercetools.history.models.common.TaxRate getTaxRate() { 117 return this.taxRate; 118 } 119 120 /** 121 * builds ShippingMethodTaxAmountChangeValue with checking for non-null required values 122 * @return ShippingMethodTaxAmountChangeValue 123 */ 124 public ShippingMethodTaxAmountChangeValue build() { 125 Objects.requireNonNull(taxedPrice, ShippingMethodTaxAmountChangeValue.class + ": taxedPrice is missing"); 126 Objects.requireNonNull(taxRate, ShippingMethodTaxAmountChangeValue.class + ": taxRate is missing"); 127 return new ShippingMethodTaxAmountChangeValueImpl(taxedPrice, taxRate); 128 } 129 130 /** 131 * builds ShippingMethodTaxAmountChangeValue without checking for non-null required values 132 * @return ShippingMethodTaxAmountChangeValue 133 */ 134 public ShippingMethodTaxAmountChangeValue buildUnchecked() { 135 return new ShippingMethodTaxAmountChangeValueImpl(taxedPrice, taxRate); 136 } 137 138 /** 139 * factory method for an instance of ShippingMethodTaxAmountChangeValueBuilder 140 * @return builder 141 */ 142 public static ShippingMethodTaxAmountChangeValueBuilder of() { 143 return new ShippingMethodTaxAmountChangeValueBuilder(); 144 } 145 146 /** 147 * create builder for ShippingMethodTaxAmountChangeValue instance 148 * @param template instance with prefilled values for the builder 149 * @return builder 150 */ 151 public static ShippingMethodTaxAmountChangeValueBuilder of(final ShippingMethodTaxAmountChangeValue template) { 152 ShippingMethodTaxAmountChangeValueBuilder builder = new ShippingMethodTaxAmountChangeValueBuilder(); 153 builder.taxedPrice = template.getTaxedPrice(); 154 builder.taxRate = template.getTaxRate(); 155 return builder; 156 } 157 158}