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 * RemoveProductSelectionChangeBuilder 012 * <hr> 013 * Example to create an instance using the builder pattern 014 * <div class=code-example> 015 * <pre><code class='java'> 016 * RemoveProductSelectionChange removeProductSelectionChange = RemoveProductSelectionChange.builder() 017 * .change("{change}") 018 * .previousValue(previousValueBuilder -> previousValueBuilder) 019 * .build() 020 * </code></pre> 021 * </div> 022 */ 023@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 024public class RemoveProductSelectionChangeBuilder implements Builder<RemoveProductSelectionChange> { 025 026 private String change; 027 028 private com.commercetools.history.models.common.ProductSelectionSetting previousValue; 029 030 /** 031 * set the value to the change 032 * @param change value to be set 033 * @return Builder 034 */ 035 036 public RemoveProductSelectionChangeBuilder change(final String change) { 037 this.change = change; 038 return this; 039 } 040 041 /** 042 * <p>Value before the change.</p> 043 * @param builder function to build the previousValue value 044 * @return Builder 045 */ 046 047 public RemoveProductSelectionChangeBuilder previousValue( 048 Function<com.commercetools.history.models.common.ProductSelectionSettingBuilder, com.commercetools.history.models.common.ProductSelectionSettingBuilder> builder) { 049 this.previousValue = builder.apply(com.commercetools.history.models.common.ProductSelectionSettingBuilder.of()) 050 .build(); 051 return this; 052 } 053 054 /** 055 * <p>Value before the change.</p> 056 * @param builder function to build the previousValue value 057 * @return Builder 058 */ 059 060 public RemoveProductSelectionChangeBuilder withPreviousValue( 061 Function<com.commercetools.history.models.common.ProductSelectionSettingBuilder, com.commercetools.history.models.common.ProductSelectionSetting> builder) { 062 this.previousValue = builder.apply(com.commercetools.history.models.common.ProductSelectionSettingBuilder.of()); 063 return this; 064 } 065 066 /** 067 * <p>Value before the change.</p> 068 * @param previousValue value to be set 069 * @return Builder 070 */ 071 072 public RemoveProductSelectionChangeBuilder previousValue( 073 final com.commercetools.history.models.common.ProductSelectionSetting previousValue) { 074 this.previousValue = previousValue; 075 return this; 076 } 077 078 /** 079 * value of change} 080 * @return change 081 */ 082 083 public String getChange() { 084 return this.change; 085 } 086 087 /** 088 * <p>Value before the change.</p> 089 * @return previousValue 090 */ 091 092 public com.commercetools.history.models.common.ProductSelectionSetting getPreviousValue() { 093 return this.previousValue; 094 } 095 096 /** 097 * builds RemoveProductSelectionChange with checking for non-null required values 098 * @return RemoveProductSelectionChange 099 */ 100 public RemoveProductSelectionChange build() { 101 Objects.requireNonNull(change, RemoveProductSelectionChange.class + ": change is missing"); 102 Objects.requireNonNull(previousValue, RemoveProductSelectionChange.class + ": previousValue is missing"); 103 return new RemoveProductSelectionChangeImpl(change, previousValue); 104 } 105 106 /** 107 * builds RemoveProductSelectionChange without checking for non-null required values 108 * @return RemoveProductSelectionChange 109 */ 110 public RemoveProductSelectionChange buildUnchecked() { 111 return new RemoveProductSelectionChangeImpl(change, previousValue); 112 } 113 114 /** 115 * factory method for an instance of RemoveProductSelectionChangeBuilder 116 * @return builder 117 */ 118 public static RemoveProductSelectionChangeBuilder of() { 119 return new RemoveProductSelectionChangeBuilder(); 120 } 121 122 /** 123 * create builder for RemoveProductSelectionChange instance 124 * @param template instance with prefilled values for the builder 125 * @return builder 126 */ 127 public static RemoveProductSelectionChangeBuilder of(final RemoveProductSelectionChange template) { 128 RemoveProductSelectionChangeBuilder builder = new RemoveProductSelectionChangeBuilder(); 129 builder.change = template.getChange(); 130 builder.previousValue = template.getPreviousValue(); 131 return builder; 132 } 133 134}