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 * SetTextLineItemCustomFieldChangeBuilder 012 * <hr> 013 * Example to create an instance using the builder pattern 014 * <div class=code-example> 015 * <pre><code class='java'> 016 * SetTextLineItemCustomFieldChange setTextLineItemCustomFieldChange = SetTextLineItemCustomFieldChange.builder() 017 * .change("{change}") 018 * .name("{name}") 019 * .customTypeId("{customTypeId}") 020 * .textLineItem(textLineItemBuilder -> textLineItemBuilder) 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 SetTextLineItemCustomFieldChangeBuilder implements Builder<SetTextLineItemCustomFieldChange> { 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 String customTypeId; 037 038 private com.commercetools.history.models.change_value.TextLineItemValue textLineItem; 039 040 /** 041 * set the value to the change 042 * @param change value to be set 043 * @return Builder 044 */ 045 046 public SetTextLineItemCustomFieldChangeBuilder 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 SetTextLineItemCustomFieldChangeBuilder 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 SetTextLineItemCustomFieldChangeBuilder 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 SetTextLineItemCustomFieldChangeBuilder name(final String name) { 080 this.name = name; 081 return this; 082 } 083 084 /** 085 * <p><code>id</code> of the referenced Type.</p> 086 * @param customTypeId value to be set 087 * @return Builder 088 */ 089 090 public SetTextLineItemCustomFieldChangeBuilder customTypeId(final String customTypeId) { 091 this.customTypeId = customTypeId; 092 return this; 093 } 094 095 /** 096 * <p>Holds information about the updated Text Line Item.</p> 097 * @param builder function to build the textLineItem value 098 * @return Builder 099 */ 100 101 public SetTextLineItemCustomFieldChangeBuilder textLineItem( 102 Function<com.commercetools.history.models.change_value.TextLineItemValueBuilder, com.commercetools.history.models.change_value.TextLineItemValueBuilder> builder) { 103 this.textLineItem = builder.apply(com.commercetools.history.models.change_value.TextLineItemValueBuilder.of()) 104 .build(); 105 return this; 106 } 107 108 /** 109 * <p>Holds information about the updated Text Line Item.</p> 110 * @param builder function to build the textLineItem value 111 * @return Builder 112 */ 113 114 public SetTextLineItemCustomFieldChangeBuilder withTextLineItem( 115 Function<com.commercetools.history.models.change_value.TextLineItemValueBuilder, com.commercetools.history.models.change_value.TextLineItemValue> builder) { 116 this.textLineItem = builder.apply(com.commercetools.history.models.change_value.TextLineItemValueBuilder.of()); 117 return this; 118 } 119 120 /** 121 * <p>Holds information about the updated Text Line Item.</p> 122 * @param textLineItem value to be set 123 * @return Builder 124 */ 125 126 public SetTextLineItemCustomFieldChangeBuilder textLineItem( 127 final com.commercetools.history.models.change_value.TextLineItemValue textLineItem) { 128 this.textLineItem = textLineItem; 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><code>id</code> of the referenced Type.</p> 170 * @return customTypeId 171 */ 172 173 public String getCustomTypeId() { 174 return this.customTypeId; 175 } 176 177 /** 178 * <p>Holds information about the updated Text Line Item.</p> 179 * @return textLineItem 180 */ 181 182 public com.commercetools.history.models.change_value.TextLineItemValue getTextLineItem() { 183 return this.textLineItem; 184 } 185 186 /** 187 * builds SetTextLineItemCustomFieldChange with checking for non-null required values 188 * @return SetTextLineItemCustomFieldChange 189 */ 190 public SetTextLineItemCustomFieldChange build() { 191 Objects.requireNonNull(change, SetTextLineItemCustomFieldChange.class + ": change is missing"); 192 Objects.requireNonNull(previousValue, SetTextLineItemCustomFieldChange.class + ": previousValue is missing"); 193 Objects.requireNonNull(nextValue, SetTextLineItemCustomFieldChange.class + ": nextValue is missing"); 194 Objects.requireNonNull(name, SetTextLineItemCustomFieldChange.class + ": name is missing"); 195 Objects.requireNonNull(customTypeId, SetTextLineItemCustomFieldChange.class + ": customTypeId is missing"); 196 Objects.requireNonNull(textLineItem, SetTextLineItemCustomFieldChange.class + ": textLineItem is missing"); 197 return new SetTextLineItemCustomFieldChangeImpl(change, previousValue, nextValue, name, customTypeId, 198 textLineItem); 199 } 200 201 /** 202 * builds SetTextLineItemCustomFieldChange without checking for non-null required values 203 * @return SetTextLineItemCustomFieldChange 204 */ 205 public SetTextLineItemCustomFieldChange buildUnchecked() { 206 return new SetTextLineItemCustomFieldChangeImpl(change, previousValue, nextValue, name, customTypeId, 207 textLineItem); 208 } 209 210 /** 211 * factory method for an instance of SetTextLineItemCustomFieldChangeBuilder 212 * @return builder 213 */ 214 public static SetTextLineItemCustomFieldChangeBuilder of() { 215 return new SetTextLineItemCustomFieldChangeBuilder(); 216 } 217 218 /** 219 * create builder for SetTextLineItemCustomFieldChange instance 220 * @param template instance with prefilled values for the builder 221 * @return builder 222 */ 223 public static SetTextLineItemCustomFieldChangeBuilder of(final SetTextLineItemCustomFieldChange template) { 224 SetTextLineItemCustomFieldChangeBuilder builder = new SetTextLineItemCustomFieldChangeBuilder(); 225 builder.change = template.getChange(); 226 builder.previousValue = template.getPreviousValue(); 227 builder.nextValue = template.getNextValue(); 228 builder.name = template.getName(); 229 builder.customTypeId = template.getCustomTypeId(); 230 builder.textLineItem = template.getTextLineItem(); 231 return builder; 232 } 233 234}