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