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