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