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