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