001
002package com.commercetools.history.models.common;
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 * LocalizedString
018 *
019 * <hr>
020 * Example to create an instance using the builder pattern
021 * <div class=code-example>
022 * <pre><code class='java'>
023 *     LocalizedString localizedString = LocalizedString.builder()
024 *             ./^[a-z]{2}(-[A-Z]{2})?$/("{/^[a-z]{2}(-[A-Z]{2})?$/}")
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 = LocalizedStringImpl.class)
031public interface LocalizedString {
032
033    /**
034     *
035     * @return map of the pattern property values
036     */
037    @NotNull
038    @JsonAnyGetter
039    public Map<String, String> values();
040
041    /**
042     * set pattern property
043     * @param key property name
044     * @param value property value
045     */
046
047    @JsonAnySetter
048    public void setValue(String key, String value);
049
050    /**
051     * factory method
052     * @return instance of LocalizedString
053     */
054    public static LocalizedString of() {
055        return new LocalizedStringImpl();
056    }
057
058    /**
059     * factory method to create a shallow copy LocalizedString
060     * @param template instance to be copied
061     * @return copy instance
062     */
063    public static LocalizedString of(final LocalizedString template) {
064        LocalizedStringImpl instance = new LocalizedStringImpl();
065        Optional.ofNullable(template.values()).ifPresent(t -> t.forEach(instance::setValue));
066        return instance;
067    }
068
069    /**
070     * factory method to create a deep copy of LocalizedString
071     * @param template instance to be copied
072     * @return copy instance
073     */
074    @Nullable
075    public static LocalizedString deepCopy(@Nullable final LocalizedString template) {
076        if (template == null) {
077            return null;
078        }
079        LocalizedStringImpl instance = new LocalizedStringImpl();
080        Optional.ofNullable(template.values()).ifPresent(t -> t.forEach(instance::setValue));
081        return instance;
082    }
083
084    /**
085     * builder factory method for LocalizedString
086     * @return builder
087     */
088    public static LocalizedStringBuilder builder() {
089        return LocalizedStringBuilder.of();
090    }
091
092    /**
093     * create builder for LocalizedString instance
094     * @param template instance with prefilled values for the builder
095     * @return builder
096     */
097    public static LocalizedStringBuilder builder(final LocalizedString template) {
098        return LocalizedStringBuilder.of(template);
099    }
100
101    /**
102     * accessor map function
103     * @param <T> mapped type
104     * @param helper function to map the object
105     * @return mapped value
106     */
107    default <T> T withLocalizedString(Function<LocalizedString, T> helper) {
108        return helper.apply(this);
109    }
110
111    /**
112     * gives a TypeReference for usage with Jackson DataBind
113     * @return TypeReference
114     */
115    public static com.fasterxml.jackson.core.type.TypeReference<LocalizedString> typeReference() {
116        return new com.fasterxml.jackson.core.type.TypeReference<LocalizedString>() {
117            @Override
118            public String toString() {
119                return "TypeReference<LocalizedString>";
120            }
121        };
122    }
123}