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