001 002package com.commercetools.api.models.error; 003 004import java.util.*; 005 006import io.vrap.rmf.base.client.Builder; 007import io.vrap.rmf.base.client.utils.Generated; 008 009/** 010 * GraphQLOutOfStockErrorBuilder 011 * <hr> 012 * Example to create an instance using the builder pattern 013 * <div class=code-example> 014 * <pre><code class='java'> 015 * GraphQLOutOfStockError graphQLOutOfStockError = GraphQLOutOfStockError.builder() 016 * .plusLineItems(lineItemsBuilder -> lineItemsBuilder) 017 * .plusSkus(skusBuilder -> skusBuilder) 018 * .build() 019 * </code></pre> 020 * </div> 021 */ 022@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 023public class GraphQLOutOfStockErrorBuilder implements Builder<GraphQLOutOfStockError> { 024 025 private Map<String, java.lang.Object> values = new HashMap<>(); 026 027 private java.util.List<String> lineItems; 028 029 private java.util.List<String> skus; 030 031 /** 032 * <p>Error-specific additional fields.</p> 033 * @param values properties to be set 034 * @return Builder 035 */ 036 037 public GraphQLOutOfStockErrorBuilder values(final Map<String, java.lang.Object> values) { 038 this.values = values; 039 return this; 040 } 041 042 /** 043 * <p>Error-specific additional fields.</p> 044 * @param key property name 045 * @param value property value 046 * @return Builder 047 */ 048 049 public GraphQLOutOfStockErrorBuilder addValue(final String key, final java.lang.Object value) { 050 if (this.values == null) { 051 values = new HashMap<>(); 052 } 053 values.put(key, value); 054 return this; 055 } 056 057 /** 058 * <p>Unique identifiers of the Line Items that are out of stock.</p> 059 * @param lineItems value to be set 060 * @return Builder 061 */ 062 063 public GraphQLOutOfStockErrorBuilder lineItems(final String... lineItems) { 064 this.lineItems = new ArrayList<>(Arrays.asList(lineItems)); 065 return this; 066 } 067 068 /** 069 * <p>Unique identifiers of the Line Items that are out of stock.</p> 070 * @param lineItems value to be set 071 * @return Builder 072 */ 073 074 public GraphQLOutOfStockErrorBuilder lineItems(final java.util.List<String> lineItems) { 075 this.lineItems = lineItems; 076 return this; 077 } 078 079 /** 080 * <p>Unique identifiers of the Line Items that are out of stock.</p> 081 * @param lineItems value to be set 082 * @return Builder 083 */ 084 085 public GraphQLOutOfStockErrorBuilder plusLineItems(final String... lineItems) { 086 if (this.lineItems == null) { 087 this.lineItems = new ArrayList<>(); 088 } 089 this.lineItems.addAll(Arrays.asList(lineItems)); 090 return this; 091 } 092 093 /** 094 * <p>SKUs of the Line Items that are out of stock.</p> 095 * @param skus value to be set 096 * @return Builder 097 */ 098 099 public GraphQLOutOfStockErrorBuilder skus(final String... skus) { 100 this.skus = new ArrayList<>(Arrays.asList(skus)); 101 return this; 102 } 103 104 /** 105 * <p>SKUs of the Line Items that are out of stock.</p> 106 * @param skus value to be set 107 * @return Builder 108 */ 109 110 public GraphQLOutOfStockErrorBuilder skus(final java.util.List<String> skus) { 111 this.skus = skus; 112 return this; 113 } 114 115 /** 116 * <p>SKUs of the Line Items that are out of stock.</p> 117 * @param skus value to be set 118 * @return Builder 119 */ 120 121 public GraphQLOutOfStockErrorBuilder plusSkus(final String... skus) { 122 if (this.skus == null) { 123 this.skus = new ArrayList<>(); 124 } 125 this.skus.addAll(Arrays.asList(skus)); 126 return this; 127 } 128 129 /** 130 * <p>Error-specific additional fields.</p> 131 * @return pattern properties 132 */ 133 134 public Map<String, java.lang.Object> getValues() { 135 return this.values; 136 } 137 138 /** 139 * <p>Unique identifiers of the Line Items that are out of stock.</p> 140 * @return lineItems 141 */ 142 143 public java.util.List<String> getLineItems() { 144 return this.lineItems; 145 } 146 147 /** 148 * <p>SKUs of the Line Items that are out of stock.</p> 149 * @return skus 150 */ 151 152 public java.util.List<String> getSkus() { 153 return this.skus; 154 } 155 156 /** 157 * builds GraphQLOutOfStockError with checking for non-null required values 158 * @return GraphQLOutOfStockError 159 */ 160 public GraphQLOutOfStockError build() { 161 Objects.requireNonNull(lineItems, GraphQLOutOfStockError.class + ": lineItems is missing"); 162 Objects.requireNonNull(skus, GraphQLOutOfStockError.class + ": skus is missing"); 163 return new GraphQLOutOfStockErrorImpl(values, lineItems, skus); 164 } 165 166 /** 167 * builds GraphQLOutOfStockError without checking for non-null required values 168 * @return GraphQLOutOfStockError 169 */ 170 public GraphQLOutOfStockError buildUnchecked() { 171 return new GraphQLOutOfStockErrorImpl(values, lineItems, skus); 172 } 173 174 /** 175 * factory method for an instance of GraphQLOutOfStockErrorBuilder 176 * @return builder 177 */ 178 public static GraphQLOutOfStockErrorBuilder of() { 179 return new GraphQLOutOfStockErrorBuilder(); 180 } 181 182 /** 183 * create builder for GraphQLOutOfStockError instance 184 * @param template instance with prefilled values for the builder 185 * @return builder 186 */ 187 public static GraphQLOutOfStockErrorBuilder of(final GraphQLOutOfStockError template) { 188 GraphQLOutOfStockErrorBuilder builder = new GraphQLOutOfStockErrorBuilder(); 189 builder.values = template.values(); 190 builder.lineItems = template.getLineItems(); 191 builder.skus = template.getSkus(); 192 return builder; 193 } 194 195}