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