001 002package com.commercetools.history.models.change; 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 * AddTaxRateChangeBuilder 012 * <hr> 013 * Example to create an instance using the builder pattern 014 * <div class=code-example> 015 * <pre><code class='java'> 016 * AddTaxRateChange addTaxRateChange = AddTaxRateChange.builder() 017 * .change("{change}") 018 * .nextValue(nextValueBuilder -> nextValueBuilder) 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 AddTaxRateChangeBuilder implements Builder<AddTaxRateChange> { 025 026 private String change; 027 028 private com.commercetools.history.models.common.TaxRate nextValue; 029 030 /** 031 * set the value to the change 032 * @param change value to be set 033 * @return Builder 034 */ 035 036 public AddTaxRateChangeBuilder change(final String change) { 037 this.change = change; 038 return this; 039 } 040 041 /** 042 * <p>Value after the change.</p> 043 * @param builder function to build the nextValue value 044 * @return Builder 045 */ 046 047 public AddTaxRateChangeBuilder nextValue( 048 Function<com.commercetools.history.models.common.TaxRateBuilder, com.commercetools.history.models.common.TaxRateBuilder> builder) { 049 this.nextValue = builder.apply(com.commercetools.history.models.common.TaxRateBuilder.of()).build(); 050 return this; 051 } 052 053 /** 054 * <p>Value after the change.</p> 055 * @param builder function to build the nextValue value 056 * @return Builder 057 */ 058 059 public AddTaxRateChangeBuilder withNextValue( 060 Function<com.commercetools.history.models.common.TaxRateBuilder, com.commercetools.history.models.common.TaxRate> builder) { 061 this.nextValue = builder.apply(com.commercetools.history.models.common.TaxRateBuilder.of()); 062 return this; 063 } 064 065 /** 066 * <p>Value after the change.</p> 067 * @param nextValue value to be set 068 * @return Builder 069 */ 070 071 public AddTaxRateChangeBuilder nextValue(final com.commercetools.history.models.common.TaxRate nextValue) { 072 this.nextValue = nextValue; 073 return this; 074 } 075 076 /** 077 * value of change} 078 * @return change 079 */ 080 081 public String getChange() { 082 return this.change; 083 } 084 085 /** 086 * <p>Value after the change.</p> 087 * @return nextValue 088 */ 089 090 public com.commercetools.history.models.common.TaxRate getNextValue() { 091 return this.nextValue; 092 } 093 094 /** 095 * builds AddTaxRateChange with checking for non-null required values 096 * @return AddTaxRateChange 097 */ 098 public AddTaxRateChange build() { 099 Objects.requireNonNull(change, AddTaxRateChange.class + ": change is missing"); 100 Objects.requireNonNull(nextValue, AddTaxRateChange.class + ": nextValue is missing"); 101 return new AddTaxRateChangeImpl(change, nextValue); 102 } 103 104 /** 105 * builds AddTaxRateChange without checking for non-null required values 106 * @return AddTaxRateChange 107 */ 108 public AddTaxRateChange buildUnchecked() { 109 return new AddTaxRateChangeImpl(change, nextValue); 110 } 111 112 /** 113 * factory method for an instance of AddTaxRateChangeBuilder 114 * @return builder 115 */ 116 public static AddTaxRateChangeBuilder of() { 117 return new AddTaxRateChangeBuilder(); 118 } 119 120 /** 121 * create builder for AddTaxRateChange instance 122 * @param template instance with prefilled values for the builder 123 * @return builder 124 */ 125 public static AddTaxRateChangeBuilder of(final AddTaxRateChange template) { 126 AddTaxRateChangeBuilder builder = new AddTaxRateChangeBuilder(); 127 builder.change = template.getChange(); 128 builder.nextValue = template.getNextValue(); 129 return builder; 130 } 131 132}