001
002package com.commercetools.api.models.error;
003
004import java.time.*;
005import java.util.*;
006import java.util.function.Function;
007
008import javax.annotation.Nullable;
009import javax.validation.constraints.NotNull;
010
011import com.fasterxml.jackson.annotation.*;
012import com.fasterxml.jackson.databind.annotation.*;
013
014import io.vrap.rmf.base.client.utils.Generated;
015
016/**
017 *  <p>Returned when an invalid JSON input has been sent. Either the JSON is syntactically incorrect or does not conform to the expected shape (for example is missing a required field).</p>
018 *  <p>The client application should validate the input according to the constraints described in the error message before sending the request.</p>
019 *
020 * <hr>
021 * Example to create an instance using the builder pattern
022 * <div class=code-example>
023 * <pre><code class='java'>
024 *     InvalidJsonInputError invalidJsonInputError = InvalidJsonInputError.builder()
025 *             .message("{message}")
026 *             .detailedErrorMessage("{detailedErrorMessage}")
027 *             .build()
028 * </code></pre>
029 * </div>
030 */
031@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
032@JsonDeserialize(as = InvalidJsonInputErrorImpl.class)
033public interface InvalidJsonInputError extends ErrorObject {
034
035    /**
036     * discriminator value for InvalidJsonInputError
037     */
038    String INVALID_JSON_INPUT = "InvalidJsonInput";
039
040    /**
041     *
042     * @return code
043     */
044    @NotNull
045    @JsonProperty("code")
046    public String getCode();
047
048    /**
049     *  <p><code>"Request body does not contain valid JSON."</code></p>
050     * @return message
051     */
052    @NotNull
053    @JsonProperty("message")
054    public String getMessage();
055
056    /**
057     *  <p>Further explanation about why the JSON is invalid.</p>
058     * @return detailedErrorMessage
059     */
060    @NotNull
061    @JsonProperty("detailedErrorMessage")
062    public String getDetailedErrorMessage();
063
064    /**
065     *  <p><code>"Request body does not contain valid JSON."</code></p>
066     * @param message value to be set
067     */
068
069    public void setMessage(final String message);
070
071    /**
072     *  <p>Further explanation about why the JSON is invalid.</p>
073     * @param detailedErrorMessage value to be set
074     */
075
076    public void setDetailedErrorMessage(final String detailedErrorMessage);
077
078    /**
079     * factory method
080     * @return instance of InvalidJsonInputError
081     */
082    public static InvalidJsonInputError of() {
083        return new InvalidJsonInputErrorImpl();
084    }
085
086    /**
087     * factory method to create a shallow copy InvalidJsonInputError
088     * @param template instance to be copied
089     * @return copy instance
090     */
091    public static InvalidJsonInputError of(final InvalidJsonInputError template) {
092        InvalidJsonInputErrorImpl instance = new InvalidJsonInputErrorImpl();
093        instance.setMessage(template.getMessage());
094        Optional.ofNullable(template.values()).ifPresent(t -> t.forEach(instance::setValue));
095        instance.setDetailedErrorMessage(template.getDetailedErrorMessage());
096        return instance;
097    }
098
099    /**
100     * factory method to create a deep copy of InvalidJsonInputError
101     * @param template instance to be copied
102     * @return copy instance
103     */
104    @Nullable
105    public static InvalidJsonInputError deepCopy(@Nullable final InvalidJsonInputError template) {
106        if (template == null) {
107            return null;
108        }
109        InvalidJsonInputErrorImpl instance = new InvalidJsonInputErrorImpl();
110        instance.setMessage(template.getMessage());
111        Optional.ofNullable(template.values()).ifPresent(t -> t.forEach(instance::setValue));
112        instance.setDetailedErrorMessage(template.getDetailedErrorMessage());
113        return instance;
114    }
115
116    /**
117     * builder factory method for InvalidJsonInputError
118     * @return builder
119     */
120    public static InvalidJsonInputErrorBuilder builder() {
121        return InvalidJsonInputErrorBuilder.of();
122    }
123
124    /**
125     * create builder for InvalidJsonInputError instance
126     * @param template instance with prefilled values for the builder
127     * @return builder
128     */
129    public static InvalidJsonInputErrorBuilder builder(final InvalidJsonInputError template) {
130        return InvalidJsonInputErrorBuilder.of(template);
131    }
132
133    /**
134     * accessor map function
135     * @param <T> mapped type
136     * @param helper function to map the object
137     * @return mapped value
138     */
139    default <T> T withInvalidJsonInputError(Function<InvalidJsonInputError, T> helper) {
140        return helper.apply(this);
141    }
142
143    /**
144     * gives a TypeReference for usage with Jackson DataBind
145     * @return TypeReference
146     */
147    public static com.fasterxml.jackson.core.type.TypeReference<InvalidJsonInputError> typeReference() {
148        return new com.fasterxml.jackson.core.type.TypeReference<InvalidJsonInputError>() {
149            @Override
150            public String toString() {
151                return "TypeReference<InvalidJsonInputError>";
152            }
153        };
154    }
155}