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