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