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