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 *     GraphQLInvalidJsonInputError graphQLInvalidJsonInputError = GraphQLInvalidJsonInputError.builder()
025 *             .detailedErrorMessage("{detailedErrorMessage}")
026 *             .build()
027 * </code></pre>
028 * </div>
029 */
030@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
031@JsonDeserialize(as = GraphQLInvalidJsonInputErrorImpl.class)
032public interface GraphQLInvalidJsonInputError extends GraphQLErrorObject {
033
034    /**
035     * discriminator value for GraphQLInvalidJsonInputError
036     */
037    String INVALID_JSON_INPUT = "InvalidJsonInput";
038
039    /**
040     *
041     * @return code
042     */
043    @NotNull
044    @JsonProperty("code")
045    public String getCode();
046
047    /**
048     *  <p>Further explanation about why the JSON is invalid.</p>
049     * @return detailedErrorMessage
050     */
051    @NotNull
052    @JsonProperty("detailedErrorMessage")
053    public String getDetailedErrorMessage();
054
055    /**
056     *  <p>Further explanation about why the JSON is invalid.</p>
057     * @param detailedErrorMessage value to be set
058     */
059
060    public void setDetailedErrorMessage(final String detailedErrorMessage);
061
062    /**
063     * factory method
064     * @return instance of GraphQLInvalidJsonInputError
065     */
066    public static GraphQLInvalidJsonInputError of() {
067        return new GraphQLInvalidJsonInputErrorImpl();
068    }
069
070    /**
071     * factory method to create a shallow copy GraphQLInvalidJsonInputError
072     * @param template instance to be copied
073     * @return copy instance
074     */
075    public static GraphQLInvalidJsonInputError of(final GraphQLInvalidJsonInputError template) {
076        GraphQLInvalidJsonInputErrorImpl instance = new GraphQLInvalidJsonInputErrorImpl();
077        Optional.ofNullable(template.values()).ifPresent(t -> t.forEach(instance::setValue));
078        instance.setDetailedErrorMessage(template.getDetailedErrorMessage());
079        return instance;
080    }
081
082    /**
083     * factory method to create a deep copy of GraphQLInvalidJsonInputError
084     * @param template instance to be copied
085     * @return copy instance
086     */
087    @Nullable
088    public static GraphQLInvalidJsonInputError deepCopy(@Nullable final GraphQLInvalidJsonInputError template) {
089        if (template == null) {
090            return null;
091        }
092        GraphQLInvalidJsonInputErrorImpl instance = new GraphQLInvalidJsonInputErrorImpl();
093        Optional.ofNullable(template.values()).ifPresent(t -> t.forEach(instance::setValue));
094        instance.setDetailedErrorMessage(template.getDetailedErrorMessage());
095        return instance;
096    }
097
098    /**
099     * builder factory method for GraphQLInvalidJsonInputError
100     * @return builder
101     */
102    public static GraphQLInvalidJsonInputErrorBuilder builder() {
103        return GraphQLInvalidJsonInputErrorBuilder.of();
104    }
105
106    /**
107     * create builder for GraphQLInvalidJsonInputError instance
108     * @param template instance with prefilled values for the builder
109     * @return builder
110     */
111    public static GraphQLInvalidJsonInputErrorBuilder builder(final GraphQLInvalidJsonInputError template) {
112        return GraphQLInvalidJsonInputErrorBuilder.of(template);
113    }
114
115    /**
116     * accessor map function
117     * @param <T> mapped type
118     * @param helper function to map the object
119     * @return mapped value
120     */
121    default <T> T withGraphQLInvalidJsonInputError(Function<GraphQLInvalidJsonInputError, T> helper) {
122        return helper.apply(this);
123    }
124
125    /**
126     * gives a TypeReference for usage with Jackson DataBind
127     * @return TypeReference
128     */
129    public static com.fasterxml.jackson.core.type.TypeReference<GraphQLInvalidJsonInputError> typeReference() {
130        return new com.fasterxml.jackson.core.type.TypeReference<GraphQLInvalidJsonInputError>() {
131            @Override
132            public String toString() {
133                return "TypeReference<GraphQLInvalidJsonInputError>";
134            }
135        };
136    }
137}