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 a language cannot be removed from a Project as it is being used by a Store.</p>
018 *  <p>The error is returned as a failed response to the Change Languages update action.</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 *     GraphQLLanguageUsedInStoresError graphQLLanguageUsedInStoresError = GraphQLLanguageUsedInStoresError.builder()
025 *             .build()
026 * </code></pre>
027 * </div>
028 */
029@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
030@JsonDeserialize(as = GraphQLLanguageUsedInStoresErrorImpl.class)
031public interface GraphQLLanguageUsedInStoresError extends GraphQLErrorObject {
032
033    /**
034     * discriminator value for GraphQLLanguageUsedInStoresError
035     */
036    String LANGUAGE_USED_IN_STORES = "LanguageUsedInStores";
037
038    /**
039     *
040     * @return code
041     */
042    @NotNull
043    @JsonProperty("code")
044    public String getCode();
045
046    /**
047     * factory method
048     * @return instance of GraphQLLanguageUsedInStoresError
049     */
050    public static GraphQLLanguageUsedInStoresError of() {
051        return new GraphQLLanguageUsedInStoresErrorImpl();
052    }
053
054    /**
055     * factory method to create a shallow copy GraphQLLanguageUsedInStoresError
056     * @param template instance to be copied
057     * @return copy instance
058     */
059    public static GraphQLLanguageUsedInStoresError of(final GraphQLLanguageUsedInStoresError template) {
060        GraphQLLanguageUsedInStoresErrorImpl instance = new GraphQLLanguageUsedInStoresErrorImpl();
061        Optional.ofNullable(template.values()).ifPresent(t -> t.forEach(instance::setValue));
062        return instance;
063    }
064
065    /**
066     * factory method to create a deep copy of GraphQLLanguageUsedInStoresError
067     * @param template instance to be copied
068     * @return copy instance
069     */
070    @Nullable
071    public static GraphQLLanguageUsedInStoresError deepCopy(@Nullable final GraphQLLanguageUsedInStoresError template) {
072        if (template == null) {
073            return null;
074        }
075        GraphQLLanguageUsedInStoresErrorImpl instance = new GraphQLLanguageUsedInStoresErrorImpl();
076        Optional.ofNullable(template.values()).ifPresent(t -> t.forEach(instance::setValue));
077        return instance;
078    }
079
080    /**
081     * builder factory method for GraphQLLanguageUsedInStoresError
082     * @return builder
083     */
084    public static GraphQLLanguageUsedInStoresErrorBuilder builder() {
085        return GraphQLLanguageUsedInStoresErrorBuilder.of();
086    }
087
088    /**
089     * create builder for GraphQLLanguageUsedInStoresError instance
090     * @param template instance with prefilled values for the builder
091     * @return builder
092     */
093    public static GraphQLLanguageUsedInStoresErrorBuilder builder(final GraphQLLanguageUsedInStoresError template) {
094        return GraphQLLanguageUsedInStoresErrorBuilder.of(template);
095    }
096
097    /**
098     * accessor map function
099     * @param <T> mapped type
100     * @param helper function to map the object
101     * @return mapped value
102     */
103    default <T> T withGraphQLLanguageUsedInStoresError(Function<GraphQLLanguageUsedInStoresError, T> helper) {
104        return helper.apply(this);
105    }
106
107    /**
108     * gives a TypeReference for usage with Jackson DataBind
109     * @return TypeReference
110     */
111    public static com.fasterxml.jackson.core.type.TypeReference<GraphQLLanguageUsedInStoresError> typeReference() {
112        return new com.fasterxml.jackson.core.type.TypeReference<GraphQLLanguageUsedInStoresError>() {
113            @Override
114            public String toString() {
115                return "TypeReference<GraphQLLanguageUsedInStoresError>";
116            }
117        };
118    }
119}