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 * SetInputTipChangeBuilder 012 * <hr> 013 * Example to create an instance using the builder pattern 014 * <div class=code-example> 015 * <pre><code class='java'> 016 * SetInputTipChange setInputTipChange = SetInputTipChange.builder() 017 * .change("{change}") 018 * .previousValue(previousValueBuilder -> previousValueBuilder) 019 * .nextValue(nextValueBuilder -> nextValueBuilder) 020 * .attributeName("{attributeName}") 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 SetInputTipChangeBuilder implements Builder<SetInputTipChange> { 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 String attributeName; 035 036 /** 037 * set the value to the change 038 * @param change value to be set 039 * @return Builder 040 */ 041 042 public SetInputTipChangeBuilder 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 SetInputTipChangeBuilder 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 SetInputTipChangeBuilder 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 SetInputTipChangeBuilder 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 SetInputTipChangeBuilder 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 SetInputTipChangeBuilder 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 SetInputTipChangeBuilder nextValue(final com.commercetools.history.models.common.LocalizedString nextValue) { 114 this.nextValue = nextValue; 115 return this; 116 } 117 118 /** 119 * <p>Name of the updated AttributeDefinition.</p> 120 * @param attributeName value to be set 121 * @return Builder 122 */ 123 124 public SetInputTipChangeBuilder attributeName(final String attributeName) { 125 this.attributeName = attributeName; 126 return this; 127 } 128 129 /** 130 * value of change} 131 * @return change 132 */ 133 134 public String getChange() { 135 return this.change; 136 } 137 138 /** 139 * <p>Value before the change.</p> 140 * @return previousValue 141 */ 142 143 public com.commercetools.history.models.common.LocalizedString getPreviousValue() { 144 return this.previousValue; 145 } 146 147 /** 148 * <p>Value after the change.</p> 149 * @return nextValue 150 */ 151 152 public com.commercetools.history.models.common.LocalizedString getNextValue() { 153 return this.nextValue; 154 } 155 156 /** 157 * <p>Name of the updated AttributeDefinition.</p> 158 * @return attributeName 159 */ 160 161 public String getAttributeName() { 162 return this.attributeName; 163 } 164 165 /** 166 * builds SetInputTipChange with checking for non-null required values 167 * @return SetInputTipChange 168 */ 169 public SetInputTipChange build() { 170 Objects.requireNonNull(change, SetInputTipChange.class + ": change is missing"); 171 Objects.requireNonNull(previousValue, SetInputTipChange.class + ": previousValue is missing"); 172 Objects.requireNonNull(nextValue, SetInputTipChange.class + ": nextValue is missing"); 173 Objects.requireNonNull(attributeName, SetInputTipChange.class + ": attributeName is missing"); 174 return new SetInputTipChangeImpl(change, previousValue, nextValue, attributeName); 175 } 176 177 /** 178 * builds SetInputTipChange without checking for non-null required values 179 * @return SetInputTipChange 180 */ 181 public SetInputTipChange buildUnchecked() { 182 return new SetInputTipChangeImpl(change, previousValue, nextValue, attributeName); 183 } 184 185 /** 186 * factory method for an instance of SetInputTipChangeBuilder 187 * @return builder 188 */ 189 public static SetInputTipChangeBuilder of() { 190 return new SetInputTipChangeBuilder(); 191 } 192 193 /** 194 * create builder for SetInputTipChange instance 195 * @param template instance with prefilled values for the builder 196 * @return builder 197 */ 198 public static SetInputTipChangeBuilder of(final SetInputTipChange template) { 199 SetInputTipChangeBuilder builder = new SetInputTipChangeBuilder(); 200 builder.change = template.getChange(); 201 builder.previousValue = template.getPreviousValue(); 202 builder.nextValue = template.getNextValue(); 203 builder.attributeName = template.getAttributeName(); 204 return builder; 205 } 206 207}