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 * BadGatewayErrorBuilder
011 * <hr>
012 * Example to create an instance using the builder pattern
013 * <div class=code-example>
014 * <pre><code class='java'>
015 *     BadGatewayError badGatewayError = BadGatewayError.builder()
016 *             .message("{message}")
017 *             .build()
018 * </code></pre>
019 * </div>
020 */
021@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
022public class BadGatewayErrorBuilder implements Builder<BadGatewayError> {
023
024    private String message;
025
026    private Map<String, java.lang.Object> values = new HashMap<>();
027
028    /**
029     *  <p>Plain text description of the error.</p>
030     * @param message value to be set
031     * @return Builder
032     */
033
034    public BadGatewayErrorBuilder message(final String message) {
035        this.message = message;
036        return this;
037    }
038
039    /**
040     *  <p>Error-specific additional fields.</p>
041     * @param values properties to be set
042     * @return Builder
043     */
044
045    public BadGatewayErrorBuilder values(final Map<String, java.lang.Object> values) {
046        this.values = values;
047        return this;
048    }
049
050    /**
051     *  <p>Error-specific additional fields.</p>
052     * @param key property name
053     * @param value property value
054     * @return Builder
055     */
056
057    public BadGatewayErrorBuilder addValue(final String key, final java.lang.Object value) {
058        if (this.values == null) {
059            values = new HashMap<>();
060        }
061        values.put(key, value);
062        return this;
063    }
064
065    /**
066     *  <p>Plain text description of the error.</p>
067     * @return message
068     */
069
070    public String getMessage() {
071        return this.message;
072    }
073
074    /**
075     *  <p>Error-specific additional fields.</p>
076     * @return pattern properties
077     */
078
079    public Map<String, java.lang.Object> getValues() {
080        return this.values;
081    }
082
083    /**
084     * builds BadGatewayError with checking for non-null required values
085     * @return BadGatewayError
086     */
087    public BadGatewayError build() {
088        Objects.requireNonNull(message, BadGatewayError.class + ": message is missing");
089        return new BadGatewayErrorImpl(message, values);
090    }
091
092    /**
093     * builds BadGatewayError without checking for non-null required values
094     * @return BadGatewayError
095     */
096    public BadGatewayError buildUnchecked() {
097        return new BadGatewayErrorImpl(message, values);
098    }
099
100    /**
101     * factory method for an instance of BadGatewayErrorBuilder
102     * @return builder
103     */
104    public static BadGatewayErrorBuilder of() {
105        return new BadGatewayErrorBuilder();
106    }
107
108    /**
109     * create builder for BadGatewayError instance
110     * @param template instance with prefilled values for the builder
111     * @return builder
112     */
113    public static BadGatewayErrorBuilder of(final BadGatewayError template) {
114        BadGatewayErrorBuilder builder = new BadGatewayErrorBuilder();
115        builder.message = template.getMessage();
116        builder.values = template.values();
117        return builder;
118    }
119
120}