001
002package com.commercetools.api.models.order;
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 * Hit
018 *
019 * <hr>
020 * Example to create an instance using the builder pattern
021 * <div class=code-example>
022 * <pre><code class='java'>
023 *     Hit hit = Hit.builder()
024 *             .id("{id}")
025 *             .version(0.3)
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 = HitImpl.class)
032public interface Hit {
033
034    /**
035     *  <p>Unique identifier of the Order.</p>
036     * @return id
037     */
038    @NotNull
039    @JsonProperty("id")
040    public String getId();
041
042    /**
043     *  <p>Current version of the Order.</p>
044     * @return version
045     */
046    @NotNull
047    @JsonProperty("version")
048    public Long getVersion();
049
050    /**
051     *  <p>The higher the value is, the more relevant the hit is for the search request.</p>
052     * @return relevance
053     */
054
055    @JsonProperty("relevance")
056    public Double getRelevance();
057
058    /**
059     *  <p>Unique identifier of the Order.</p>
060     * @param id value to be set
061     */
062
063    public void setId(final String id);
064
065    /**
066     *  <p>Current version of the Order.</p>
067     * @param version value to be set
068     */
069
070    public void setVersion(final Long version);
071
072    /**
073     *  <p>The higher the value is, the more relevant the hit is for the search request.</p>
074     * @param relevance value to be set
075     */
076
077    public void setRelevance(final Double relevance);
078
079    /**
080     * factory method
081     * @return instance of Hit
082     */
083    public static Hit of() {
084        return new HitImpl();
085    }
086
087    /**
088     * factory method to create a shallow copy Hit
089     * @param template instance to be copied
090     * @return copy instance
091     */
092    public static Hit of(final Hit template) {
093        HitImpl instance = new HitImpl();
094        instance.setId(template.getId());
095        instance.setVersion(template.getVersion());
096        instance.setRelevance(template.getRelevance());
097        return instance;
098    }
099
100    /**
101     * factory method to create a deep copy of Hit
102     * @param template instance to be copied
103     * @return copy instance
104     */
105    @Nullable
106    public static Hit deepCopy(@Nullable final Hit template) {
107        if (template == null) {
108            return null;
109        }
110        HitImpl instance = new HitImpl();
111        instance.setId(template.getId());
112        instance.setVersion(template.getVersion());
113        instance.setRelevance(template.getRelevance());
114        return instance;
115    }
116
117    /**
118     * builder factory method for Hit
119     * @return builder
120     */
121    public static HitBuilder builder() {
122        return HitBuilder.of();
123    }
124
125    /**
126     * create builder for Hit instance
127     * @param template instance with prefilled values for the builder
128     * @return builder
129     */
130    public static HitBuilder builder(final Hit template) {
131        return HitBuilder.of(template);
132    }
133
134    /**
135     * accessor map function
136     * @param <T> mapped type
137     * @param helper function to map the object
138     * @return mapped value
139     */
140    default <T> T withHit(Function<Hit, T> helper) {
141        return helper.apply(this);
142    }
143
144    /**
145     * gives a TypeReference for usage with Jackson DataBind
146     * @return TypeReference
147     */
148    public static com.fasterxml.jackson.core.type.TypeReference<Hit> typeReference() {
149        return new com.fasterxml.jackson.core.type.TypeReference<Hit>() {
150            @Override
151            public String toString() {
152                return "TypeReference<Hit>";
153            }
154        };
155    }
156}