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 * SetShoppingListLineItemCustomFieldChangeBuilder 012 * <hr> 013 * Example to create an instance using the builder pattern 014 * <div class=code-example> 015 * <pre><code class='java'> 016 * SetShoppingListLineItemCustomFieldChange setShoppingListLineItemCustomFieldChange = SetShoppingListLineItemCustomFieldChange.builder() 017 * .change("{change}") 018 * .name("{name}") 019 * .customTypeId("{customTypeId}") 020 * .lineItem(lineItemBuilder -> lineItemBuilder) 021 * .build() 022 * </code></pre> 023 * </div> 024 */ 025@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 026public class SetShoppingListLineItemCustomFieldChangeBuilder 027 implements Builder<SetShoppingListLineItemCustomFieldChange> { 028 029 private String change; 030 031 private java.lang.Object previousValue; 032 033 private java.lang.Object nextValue; 034 035 private String name; 036 037 private String customTypeId; 038 039 private com.commercetools.history.models.change_value.ShoppingListLineItemValue lineItem; 040 041 /** 042 * set the value to the change 043 * @param change value to be set 044 * @return Builder 045 */ 046 047 public SetShoppingListLineItemCustomFieldChangeBuilder change(final String change) { 048 this.change = change; 049 return this; 050 } 051 052 /** 053 * <p>Value before the change.</p> 054 * @param previousValue value to be set 055 * @return Builder 056 */ 057 058 public SetShoppingListLineItemCustomFieldChangeBuilder previousValue(final java.lang.Object previousValue) { 059 this.previousValue = previousValue; 060 return this; 061 } 062 063 /** 064 * <p>Value after the change.</p> 065 * @param nextValue value to be set 066 * @return Builder 067 */ 068 069 public SetShoppingListLineItemCustomFieldChangeBuilder nextValue(final java.lang.Object nextValue) { 070 this.nextValue = nextValue; 071 return this; 072 } 073 074 /** 075 * <p>Name of the Custom Field.</p> 076 * @param name value to be set 077 * @return Builder 078 */ 079 080 public SetShoppingListLineItemCustomFieldChangeBuilder name(final String name) { 081 this.name = name; 082 return this; 083 } 084 085 /** 086 * <p><code>id</code> of the referenced Type.</p> 087 * @param customTypeId value to be set 088 * @return Builder 089 */ 090 091 public SetShoppingListLineItemCustomFieldChangeBuilder customTypeId(final String customTypeId) { 092 this.customTypeId = customTypeId; 093 return this; 094 } 095 096 /** 097 * <p>Holds information about the updated Shopping List Line Item.</p> 098 * @param builder function to build the lineItem value 099 * @return Builder 100 */ 101 102 public SetShoppingListLineItemCustomFieldChangeBuilder lineItem( 103 Function<com.commercetools.history.models.change_value.ShoppingListLineItemValueBuilder, com.commercetools.history.models.change_value.ShoppingListLineItemValueBuilder> builder) { 104 this.lineItem = builder 105 .apply(com.commercetools.history.models.change_value.ShoppingListLineItemValueBuilder.of()) 106 .build(); 107 return this; 108 } 109 110 /** 111 * <p>Holds information about the updated Shopping List Line Item.</p> 112 * @param builder function to build the lineItem value 113 * @return Builder 114 */ 115 116 public SetShoppingListLineItemCustomFieldChangeBuilder withLineItem( 117 Function<com.commercetools.history.models.change_value.ShoppingListLineItemValueBuilder, com.commercetools.history.models.change_value.ShoppingListLineItemValue> builder) { 118 this.lineItem = builder 119 .apply(com.commercetools.history.models.change_value.ShoppingListLineItemValueBuilder.of()); 120 return this; 121 } 122 123 /** 124 * <p>Holds information about the updated Shopping List Line Item.</p> 125 * @param lineItem value to be set 126 * @return Builder 127 */ 128 129 public SetShoppingListLineItemCustomFieldChangeBuilder lineItem( 130 final com.commercetools.history.models.change_value.ShoppingListLineItemValue lineItem) { 131 this.lineItem = lineItem; 132 return this; 133 } 134 135 /** 136 * value of change} 137 * @return change 138 */ 139 140 public String getChange() { 141 return this.change; 142 } 143 144 /** 145 * <p>Value before the change.</p> 146 * @return previousValue 147 */ 148 149 public java.lang.Object getPreviousValue() { 150 return this.previousValue; 151 } 152 153 /** 154 * <p>Value after the change.</p> 155 * @return nextValue 156 */ 157 158 public java.lang.Object getNextValue() { 159 return this.nextValue; 160 } 161 162 /** 163 * <p>Name of the Custom Field.</p> 164 * @return name 165 */ 166 167 public String getName() { 168 return this.name; 169 } 170 171 /** 172 * <p><code>id</code> of the referenced Type.</p> 173 * @return customTypeId 174 */ 175 176 public String getCustomTypeId() { 177 return this.customTypeId; 178 } 179 180 /** 181 * <p>Holds information about the updated Shopping List Line Item.</p> 182 * @return lineItem 183 */ 184 185 public com.commercetools.history.models.change_value.ShoppingListLineItemValue getLineItem() { 186 return this.lineItem; 187 } 188 189 /** 190 * builds SetShoppingListLineItemCustomFieldChange with checking for non-null required values 191 * @return SetShoppingListLineItemCustomFieldChange 192 */ 193 public SetShoppingListLineItemCustomFieldChange build() { 194 Objects.requireNonNull(change, SetShoppingListLineItemCustomFieldChange.class + ": change is missing"); 195 Objects.requireNonNull(previousValue, 196 SetShoppingListLineItemCustomFieldChange.class + ": previousValue is missing"); 197 Objects.requireNonNull(nextValue, SetShoppingListLineItemCustomFieldChange.class + ": nextValue is missing"); 198 Objects.requireNonNull(name, SetShoppingListLineItemCustomFieldChange.class + ": name is missing"); 199 Objects.requireNonNull(customTypeId, 200 SetShoppingListLineItemCustomFieldChange.class + ": customTypeId is missing"); 201 Objects.requireNonNull(lineItem, SetShoppingListLineItemCustomFieldChange.class + ": lineItem is missing"); 202 return new SetShoppingListLineItemCustomFieldChangeImpl(change, previousValue, nextValue, name, customTypeId, 203 lineItem); 204 } 205 206 /** 207 * builds SetShoppingListLineItemCustomFieldChange without checking for non-null required values 208 * @return SetShoppingListLineItemCustomFieldChange 209 */ 210 public SetShoppingListLineItemCustomFieldChange buildUnchecked() { 211 return new SetShoppingListLineItemCustomFieldChangeImpl(change, previousValue, nextValue, name, customTypeId, 212 lineItem); 213 } 214 215 /** 216 * factory method for an instance of SetShoppingListLineItemCustomFieldChangeBuilder 217 * @return builder 218 */ 219 public static SetShoppingListLineItemCustomFieldChangeBuilder of() { 220 return new SetShoppingListLineItemCustomFieldChangeBuilder(); 221 } 222 223 /** 224 * create builder for SetShoppingListLineItemCustomFieldChange instance 225 * @param template instance with prefilled values for the builder 226 * @return builder 227 */ 228 public static SetShoppingListLineItemCustomFieldChangeBuilder of( 229 final SetShoppingListLineItemCustomFieldChange template) { 230 SetShoppingListLineItemCustomFieldChangeBuilder builder = new SetShoppingListLineItemCustomFieldChangeBuilder(); 231 builder.change = template.getChange(); 232 builder.previousValue = template.getPreviousValue(); 233 builder.nextValue = template.getNextValue(); 234 builder.name = template.getName(); 235 builder.customTypeId = template.getCustomTypeId(); 236 builder.lineItem = template.getLineItem(); 237 return builder; 238 } 239 240}