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 * AddProductChangeBuilder 012 * <hr> 013 * Example to create an instance using the builder pattern 014 * <div class=code-example> 015 * <pre><code class='java'> 016 * AddProductChange addProductChange = AddProductChange.builder() 017 * .change("{change}") 018 * .nextValue(nextValueBuilder -> nextValueBuilder) 019 * .variantSelection(variantSelectionBuilder -> variantSelectionBuilder) 020 * .build() 021 * </code></pre> 022 * </div> 023 */ 024@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 025public class AddProductChangeBuilder implements Builder<AddProductChange> { 026 027 private String change; 028 029 private com.commercetools.history.models.common.Reference nextValue; 030 031 private com.commercetools.history.models.common.ProductVariantSelection variantSelection; 032 033 /** 034 * set the value to the change 035 * @param change value to be set 036 * @return Builder 037 */ 038 039 public AddProductChangeBuilder change(final String change) { 040 this.change = change; 041 return this; 042 } 043 044 /** 045 * <p>Value after the change.</p> 046 * @param builder function to build the nextValue value 047 * @return Builder 048 */ 049 050 public AddProductChangeBuilder nextValue( 051 Function<com.commercetools.history.models.common.ReferenceBuilder, com.commercetools.history.models.common.ReferenceBuilder> builder) { 052 this.nextValue = builder.apply(com.commercetools.history.models.common.ReferenceBuilder.of()).build(); 053 return this; 054 } 055 056 /** 057 * <p>Value after the change.</p> 058 * @param builder function to build the nextValue value 059 * @return Builder 060 */ 061 062 public AddProductChangeBuilder withNextValue( 063 Function<com.commercetools.history.models.common.ReferenceBuilder, com.commercetools.history.models.common.Reference> builder) { 064 this.nextValue = builder.apply(com.commercetools.history.models.common.ReferenceBuilder.of()); 065 return this; 066 } 067 068 /** 069 * <p>Value after the change.</p> 070 * @param nextValue value to be set 071 * @return Builder 072 */ 073 074 public AddProductChangeBuilder nextValue(final com.commercetools.history.models.common.Reference nextValue) { 075 this.nextValue = nextValue; 076 return this; 077 } 078 079 /** 080 * <p>The Product Variants included in the Product Selection.</p> 081 * @param builder function to build the variantSelection value 082 * @return Builder 083 */ 084 085 public AddProductChangeBuilder variantSelection( 086 Function<com.commercetools.history.models.common.ProductVariantSelectionBuilder, com.commercetools.history.models.common.ProductVariantSelectionBuilder> builder) { 087 this.variantSelection = builder 088 .apply(com.commercetools.history.models.common.ProductVariantSelectionBuilder.of()) 089 .build(); 090 return this; 091 } 092 093 /** 094 * <p>The Product Variants included in the Product Selection.</p> 095 * @param builder function to build the variantSelection value 096 * @return Builder 097 */ 098 099 public AddProductChangeBuilder withVariantSelection( 100 Function<com.commercetools.history.models.common.ProductVariantSelectionBuilder, com.commercetools.history.models.common.ProductVariantSelection> builder) { 101 this.variantSelection = builder 102 .apply(com.commercetools.history.models.common.ProductVariantSelectionBuilder.of()); 103 return this; 104 } 105 106 /** 107 * <p>The Product Variants included in the Product Selection.</p> 108 * @param variantSelection value to be set 109 * @return Builder 110 */ 111 112 public AddProductChangeBuilder variantSelection( 113 final com.commercetools.history.models.common.ProductVariantSelection variantSelection) { 114 this.variantSelection = variantSelection; 115 return this; 116 } 117 118 /** 119 * value of change} 120 * @return change 121 */ 122 123 public String getChange() { 124 return this.change; 125 } 126 127 /** 128 * <p>Value after the change.</p> 129 * @return nextValue 130 */ 131 132 public com.commercetools.history.models.common.Reference getNextValue() { 133 return this.nextValue; 134 } 135 136 /** 137 * <p>The Product Variants included in the Product Selection.</p> 138 * @return variantSelection 139 */ 140 141 public com.commercetools.history.models.common.ProductVariantSelection getVariantSelection() { 142 return this.variantSelection; 143 } 144 145 /** 146 * builds AddProductChange with checking for non-null required values 147 * @return AddProductChange 148 */ 149 public AddProductChange build() { 150 Objects.requireNonNull(change, AddProductChange.class + ": change is missing"); 151 Objects.requireNonNull(nextValue, AddProductChange.class + ": nextValue is missing"); 152 Objects.requireNonNull(variantSelection, AddProductChange.class + ": variantSelection is missing"); 153 return new AddProductChangeImpl(change, nextValue, variantSelection); 154 } 155 156 /** 157 * builds AddProductChange without checking for non-null required values 158 * @return AddProductChange 159 */ 160 public AddProductChange buildUnchecked() { 161 return new AddProductChangeImpl(change, nextValue, variantSelection); 162 } 163 164 /** 165 * factory method for an instance of AddProductChangeBuilder 166 * @return builder 167 */ 168 public static AddProductChangeBuilder of() { 169 return new AddProductChangeBuilder(); 170 } 171 172 /** 173 * create builder for AddProductChange instance 174 * @param template instance with prefilled values for the builder 175 * @return builder 176 */ 177 public static AddProductChangeBuilder of(final AddProductChange template) { 178 AddProductChangeBuilder builder = new AddProductChangeBuilder(); 179 builder.change = template.getChange(); 180 builder.nextValue = template.getNextValue(); 181 builder.variantSelection = template.getVariantSelection(); 182 return builder; 183 } 184 185}