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 * RemoveInheritedAssociateChangeBuilder 012 * <hr> 013 * Example to create an instance using the builder pattern 014 * <div class=code-example> 015 * <pre><code class='java'> 016 * RemoveInheritedAssociateChange removeInheritedAssociateChange = RemoveInheritedAssociateChange.builder() 017 * .change("{change}") 018 * .previousValue(previousValueBuilder -> previousValueBuilder) 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 RemoveInheritedAssociateChangeBuilder implements Builder<RemoveInheritedAssociateChange> { 025 026 private String change; 027 028 private com.commercetools.history.models.common.InheritedAssociate previousValue; 029 030 /** 031 * set the value to the change 032 * @param change value to be set 033 * @return Builder 034 */ 035 036 public RemoveInheritedAssociateChangeBuilder change(final String change) { 037 this.change = change; 038 return this; 039 } 040 041 /** 042 * <p>The value before the change.</p> 043 * @param builder function to build the previousValue value 044 * @return Builder 045 */ 046 047 public RemoveInheritedAssociateChangeBuilder previousValue( 048 Function<com.commercetools.history.models.common.InheritedAssociateBuilder, com.commercetools.history.models.common.InheritedAssociateBuilder> builder) { 049 this.previousValue = builder.apply(com.commercetools.history.models.common.InheritedAssociateBuilder.of()) 050 .build(); 051 return this; 052 } 053 054 /** 055 * <p>The value before the change.</p> 056 * @param builder function to build the previousValue value 057 * @return Builder 058 */ 059 060 public RemoveInheritedAssociateChangeBuilder withPreviousValue( 061 Function<com.commercetools.history.models.common.InheritedAssociateBuilder, com.commercetools.history.models.common.InheritedAssociate> builder) { 062 this.previousValue = builder.apply(com.commercetools.history.models.common.InheritedAssociateBuilder.of()); 063 return this; 064 } 065 066 /** 067 * <p>The value before the change.</p> 068 * @param previousValue value to be set 069 * @return Builder 070 */ 071 072 public RemoveInheritedAssociateChangeBuilder previousValue( 073 final com.commercetools.history.models.common.InheritedAssociate previousValue) { 074 this.previousValue = previousValue; 075 return this; 076 } 077 078 /** 079 * value of change} 080 * @return change 081 */ 082 083 public String getChange() { 084 return this.change; 085 } 086 087 /** 088 * <p>The value before the change.</p> 089 * @return previousValue 090 */ 091 092 public com.commercetools.history.models.common.InheritedAssociate getPreviousValue() { 093 return this.previousValue; 094 } 095 096 /** 097 * builds RemoveInheritedAssociateChange with checking for non-null required values 098 * @return RemoveInheritedAssociateChange 099 */ 100 public RemoveInheritedAssociateChange build() { 101 Objects.requireNonNull(change, RemoveInheritedAssociateChange.class + ": change is missing"); 102 Objects.requireNonNull(previousValue, RemoveInheritedAssociateChange.class + ": previousValue is missing"); 103 return new RemoveInheritedAssociateChangeImpl(change, previousValue); 104 } 105 106 /** 107 * builds RemoveInheritedAssociateChange without checking for non-null required values 108 * @return RemoveInheritedAssociateChange 109 */ 110 public RemoveInheritedAssociateChange buildUnchecked() { 111 return new RemoveInheritedAssociateChangeImpl(change, previousValue); 112 } 113 114 /** 115 * factory method for an instance of RemoveInheritedAssociateChangeBuilder 116 * @return builder 117 */ 118 public static RemoveInheritedAssociateChangeBuilder of() { 119 return new RemoveInheritedAssociateChangeBuilder(); 120 } 121 122 /** 123 * create builder for RemoveInheritedAssociateChange instance 124 * @param template instance with prefilled values for the builder 125 * @return builder 126 */ 127 public static RemoveInheritedAssociateChangeBuilder of(final RemoveInheritedAssociateChange template) { 128 RemoveInheritedAssociateChangeBuilder builder = new RemoveInheritedAssociateChangeBuilder(); 129 builder.change = template.getChange(); 130 builder.previousValue = template.getPreviousValue(); 131 return builder; 132 } 133 134}