001 002package com.commercetools.history.models.change_value; 003 004import java.util.*; 005 006import io.vrap.rmf.base.client.Builder; 007import io.vrap.rmf.base.client.utils.Generated; 008 009/** 010 * TransactionChangeValueBuilder 011 * <hr> 012 * Example to create an instance using the builder pattern 013 * <div class=code-example> 014 * <pre><code class='java'> 015 * TransactionChangeValue transactionChangeValue = TransactionChangeValue.builder() 016 * .id("{id}") 017 * .interactionId("{interactionId}") 018 * .timestamp("{timestamp}") 019 * .build() 020 * </code></pre> 021 * </div> 022 */ 023@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 024public class TransactionChangeValueBuilder implements Builder<TransactionChangeValue> { 025 026 private String id; 027 028 private String interactionId; 029 030 private String timestamp; 031 032 /** 033 * <p><code>id</code> of the Transaction.</p> 034 * @param id value to be set 035 * @return Builder 036 */ 037 038 public TransactionChangeValueBuilder id(final String id) { 039 this.id = id; 040 return this; 041 } 042 043 /** 044 * <p>Identifier used by the interface that manages the Transaction (usually the PSP).</p> 045 * @param interactionId value to be set 046 * @return Builder 047 */ 048 049 public TransactionChangeValueBuilder interactionId(final String interactionId) { 050 this.interactionId = interactionId; 051 return this; 052 } 053 054 /** 055 * <p>Date and time (UTC) the Transaction took place.</p> 056 * @param timestamp value to be set 057 * @return Builder 058 */ 059 060 public TransactionChangeValueBuilder timestamp(final String timestamp) { 061 this.timestamp = timestamp; 062 return this; 063 } 064 065 /** 066 * <p><code>id</code> of the Transaction.</p> 067 * @return id 068 */ 069 070 public String getId() { 071 return this.id; 072 } 073 074 /** 075 * <p>Identifier used by the interface that manages the Transaction (usually the PSP).</p> 076 * @return interactionId 077 */ 078 079 public String getInteractionId() { 080 return this.interactionId; 081 } 082 083 /** 084 * <p>Date and time (UTC) the Transaction took place.</p> 085 * @return timestamp 086 */ 087 088 public String getTimestamp() { 089 return this.timestamp; 090 } 091 092 /** 093 * builds TransactionChangeValue with checking for non-null required values 094 * @return TransactionChangeValue 095 */ 096 public TransactionChangeValue build() { 097 Objects.requireNonNull(id, TransactionChangeValue.class + ": id is missing"); 098 Objects.requireNonNull(interactionId, TransactionChangeValue.class + ": interactionId is missing"); 099 Objects.requireNonNull(timestamp, TransactionChangeValue.class + ": timestamp is missing"); 100 return new TransactionChangeValueImpl(id, interactionId, timestamp); 101 } 102 103 /** 104 * builds TransactionChangeValue without checking for non-null required values 105 * @return TransactionChangeValue 106 */ 107 public TransactionChangeValue buildUnchecked() { 108 return new TransactionChangeValueImpl(id, interactionId, timestamp); 109 } 110 111 /** 112 * factory method for an instance of TransactionChangeValueBuilder 113 * @return builder 114 */ 115 public static TransactionChangeValueBuilder of() { 116 return new TransactionChangeValueBuilder(); 117 } 118 119 /** 120 * create builder for TransactionChangeValue instance 121 * @param template instance with prefilled values for the builder 122 * @return builder 123 */ 124 public static TransactionChangeValueBuilder of(final TransactionChangeValue template) { 125 TransactionChangeValueBuilder builder = new TransactionChangeValueBuilder(); 126 builder.id = template.getId(); 127 builder.interactionId = template.getInteractionId(); 128 builder.timestamp = template.getTimestamp(); 129 return builder; 130 } 131 132}