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 * AddEnumValueChangeBuilder 012 * <hr> 013 * Example to create an instance using the builder pattern 014 * <div class=code-example> 015 * <pre><code class='java'> 016 * AddEnumValueChange addEnumValueChange = AddEnumValueChange.builder() 017 * .change("{change}") 018 * .nextValue(nextValueBuilder -> nextValueBuilder) 019 * .fieldName("{fieldName}") 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 AddEnumValueChangeBuilder implements Builder<AddEnumValueChange> { 026 027 private String change; 028 029 private com.commercetools.history.models.change_value.EnumValue nextValue; 030 031 private String fieldName; 032 033 /** 034 * set the value to the change 035 * @param change value to be set 036 * @return Builder 037 */ 038 039 public AddEnumValueChangeBuilder change(final String change) { 040 this.change = change; 041 return this; 042 } 043 044 /** 045 * <p>Value after the change.</p> 046 * @param builder function to build the nextValue value 047 * @return Builder 048 */ 049 050 public AddEnumValueChangeBuilder nextValue( 051 Function<com.commercetools.history.models.change_value.EnumValueBuilder, com.commercetools.history.models.change_value.EnumValueBuilder> builder) { 052 this.nextValue = builder.apply(com.commercetools.history.models.change_value.EnumValueBuilder.of()).build(); 053 return this; 054 } 055 056 /** 057 * <p>Value after the change.</p> 058 * @param builder function to build the nextValue value 059 * @return Builder 060 */ 061 062 public AddEnumValueChangeBuilder withNextValue( 063 Function<com.commercetools.history.models.change_value.EnumValueBuilder, com.commercetools.history.models.change_value.EnumValue> builder) { 064 this.nextValue = builder.apply(com.commercetools.history.models.change_value.EnumValueBuilder.of()); 065 return this; 066 } 067 068 /** 069 * <p>Value after the change.</p> 070 * @param nextValue value to be set 071 * @return Builder 072 */ 073 074 public AddEnumValueChangeBuilder nextValue( 075 final com.commercetools.history.models.change_value.EnumValue nextValue) { 076 this.nextValue = nextValue; 077 return this; 078 } 079 080 /** 081 * <p>Name of the updated FieldDefinition.</p> 082 * @param fieldName value to be set 083 * @return Builder 084 */ 085 086 public AddEnumValueChangeBuilder fieldName(final String fieldName) { 087 this.fieldName = fieldName; 088 return this; 089 } 090 091 /** 092 * value of change} 093 * @return change 094 */ 095 096 public String getChange() { 097 return this.change; 098 } 099 100 /** 101 * <p>Value after the change.</p> 102 * @return nextValue 103 */ 104 105 public com.commercetools.history.models.change_value.EnumValue getNextValue() { 106 return this.nextValue; 107 } 108 109 /** 110 * <p>Name of the updated FieldDefinition.</p> 111 * @return fieldName 112 */ 113 114 public String getFieldName() { 115 return this.fieldName; 116 } 117 118 /** 119 * builds AddEnumValueChange with checking for non-null required values 120 * @return AddEnumValueChange 121 */ 122 public AddEnumValueChange build() { 123 Objects.requireNonNull(change, AddEnumValueChange.class + ": change is missing"); 124 Objects.requireNonNull(nextValue, AddEnumValueChange.class + ": nextValue is missing"); 125 Objects.requireNonNull(fieldName, AddEnumValueChange.class + ": fieldName is missing"); 126 return new AddEnumValueChangeImpl(change, nextValue, fieldName); 127 } 128 129 /** 130 * builds AddEnumValueChange without checking for non-null required values 131 * @return AddEnumValueChange 132 */ 133 public AddEnumValueChange buildUnchecked() { 134 return new AddEnumValueChangeImpl(change, nextValue, fieldName); 135 } 136 137 /** 138 * factory method for an instance of AddEnumValueChangeBuilder 139 * @return builder 140 */ 141 public static AddEnumValueChangeBuilder of() { 142 return new AddEnumValueChangeBuilder(); 143 } 144 145 /** 146 * create builder for AddEnumValueChange instance 147 * @param template instance with prefilled values for the builder 148 * @return builder 149 */ 150 public static AddEnumValueChangeBuilder of(final AddEnumValueChange template) { 151 AddEnumValueChangeBuilder builder = new AddEnumValueChangeBuilder(); 152 builder.change = template.getChange(); 153 builder.nextValue = template.getNextValue(); 154 builder.fieldName = template.getFieldName(); 155 return builder; 156 } 157 158}