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 * GraphQLPriceChangedErrorBuilder
011 * <hr>
012 * Example to create an instance using the builder pattern
013 * <div class=code-example>
014 * <pre><code class='java'>
015 *     GraphQLPriceChangedError graphQLPriceChangedError = GraphQLPriceChangedError.builder()
016 *             .plusLineItems(lineItemsBuilder -> lineItemsBuilder)
017 *             .shipping(true)
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 GraphQLPriceChangedErrorBuilder implements Builder<GraphQLPriceChangedError> {
024
025    private Map<String, java.lang.Object> values = new HashMap<>();
026
027    private java.util.List<String> lineItems;
028
029    private Boolean shipping;
030
031    /**
032     *  <p>Error-specific additional fields.</p>
033     * @param values properties to be set
034     * @return Builder
035     */
036
037    public GraphQLPriceChangedErrorBuilder 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 GraphQLPriceChangedErrorBuilder 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 for which the Price or TaxRate has changed.</p>
059     * @param lineItems value to be set
060     * @return Builder
061     */
062
063    public GraphQLPriceChangedErrorBuilder 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 for which the Price or TaxRate has changed.</p>
070     * @param lineItems value to be set
071     * @return Builder
072     */
073
074    public GraphQLPriceChangedErrorBuilder 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 for which the Price or TaxRate has changed.</p>
081     * @param lineItems value to be set
082     * @return Builder
083     */
084
085    public GraphQLPriceChangedErrorBuilder 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><code>true</code> if the ShippingRate has changed.</p>
095     * @param shipping value to be set
096     * @return Builder
097     */
098
099    public GraphQLPriceChangedErrorBuilder shipping(final Boolean shipping) {
100        this.shipping = shipping;
101        return this;
102    }
103
104    /**
105     *  <p>Error-specific additional fields.</p>
106     * @return pattern properties
107     */
108
109    public Map<String, java.lang.Object> getValues() {
110        return this.values;
111    }
112
113    /**
114     *  <p>Unique identifiers of the Line Items for which the Price or TaxRate has changed.</p>
115     * @return lineItems
116     */
117
118    public java.util.List<String> getLineItems() {
119        return this.lineItems;
120    }
121
122    /**
123     *  <p><code>true</code> if the ShippingRate has changed.</p>
124     * @return shipping
125     */
126
127    public Boolean getShipping() {
128        return this.shipping;
129    }
130
131    /**
132     * builds GraphQLPriceChangedError with checking for non-null required values
133     * @return GraphQLPriceChangedError
134     */
135    public GraphQLPriceChangedError build() {
136        Objects.requireNonNull(lineItems, GraphQLPriceChangedError.class + ": lineItems is missing");
137        Objects.requireNonNull(shipping, GraphQLPriceChangedError.class + ": shipping is missing");
138        return new GraphQLPriceChangedErrorImpl(values, lineItems, shipping);
139    }
140
141    /**
142     * builds GraphQLPriceChangedError without checking for non-null required values
143     * @return GraphQLPriceChangedError
144     */
145    public GraphQLPriceChangedError buildUnchecked() {
146        return new GraphQLPriceChangedErrorImpl(values, lineItems, shipping);
147    }
148
149    /**
150     * factory method for an instance of GraphQLPriceChangedErrorBuilder
151     * @return builder
152     */
153    public static GraphQLPriceChangedErrorBuilder of() {
154        return new GraphQLPriceChangedErrorBuilder();
155    }
156
157    /**
158     * create builder for GraphQLPriceChangedError instance
159     * @param template instance with prefilled values for the builder
160     * @return builder
161     */
162    public static GraphQLPriceChangedErrorBuilder of(final GraphQLPriceChangedError template) {
163        GraphQLPriceChangedErrorBuilder builder = new GraphQLPriceChangedErrorBuilder();
164        builder.values = template.values();
165        builder.lineItems = template.getLineItems();
166        builder.shipping = template.getShipping();
167        return builder;
168    }
169
170}