001
002package com.commercetools.importapi.models.products;
003
004import java.util.*;
005import java.util.function.Function;
006
007import javax.annotation.Nullable;
008
009import io.vrap.rmf.base.client.Builder;
010import io.vrap.rmf.base.client.utils.Generated;
011
012/**
013 * SearchKeywordBuilder
014 * <hr>
015 * Example to create an instance using the builder pattern
016 * <div class=code-example>
017 * <pre><code class='java'>
018 *     SearchKeyword searchKeyword = SearchKeyword.builder()
019 *             .text("{text}")
020 *             .build()
021 * </code></pre>
022 * </div>
023 */
024@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
025public class SearchKeywordBuilder implements Builder<SearchKeyword> {
026
027    private String text;
028
029    @Nullable
030    private com.commercetools.importapi.models.products.SuggestTokenizer suggestTokenizer;
031
032    /**
033     * set the value to the text
034     * @param text value to be set
035     * @return Builder
036     */
037
038    public SearchKeywordBuilder text(final String text) {
039        this.text = text;
040        return this;
041    }
042
043    /**
044     *  <p>The tokenizer defines the tokens that are used to match against the Suggest Query input.</p>
045     * @param suggestTokenizer value to be set
046     * @return Builder
047     */
048
049    public SearchKeywordBuilder suggestTokenizer(
050            @Nullable final com.commercetools.importapi.models.products.SuggestTokenizer suggestTokenizer) {
051        this.suggestTokenizer = suggestTokenizer;
052        return this;
053    }
054
055    /**
056     *  <p>The tokenizer defines the tokens that are used to match against the Suggest Query input.</p>
057     * @param builder function to build the suggestTokenizer value
058     * @return Builder
059     */
060
061    public SearchKeywordBuilder suggestTokenizer(
062            Function<com.commercetools.importapi.models.products.SuggestTokenizerBuilder, Builder<? extends com.commercetools.importapi.models.products.SuggestTokenizer>> builder) {
063        this.suggestTokenizer = builder.apply(com.commercetools.importapi.models.products.SuggestTokenizerBuilder.of())
064                .build();
065        return this;
066    }
067
068    /**
069     * value of text}
070     * @return text
071     */
072
073    public String getText() {
074        return this.text;
075    }
076
077    /**
078     *  <p>The tokenizer defines the tokens that are used to match against the Suggest Query input.</p>
079     * @return suggestTokenizer
080     */
081
082    @Nullable
083    public com.commercetools.importapi.models.products.SuggestTokenizer getSuggestTokenizer() {
084        return this.suggestTokenizer;
085    }
086
087    /**
088     * builds SearchKeyword with checking for non-null required values
089     * @return SearchKeyword
090     */
091    public SearchKeyword build() {
092        Objects.requireNonNull(text, SearchKeyword.class + ": text is missing");
093        return new SearchKeywordImpl(text, suggestTokenizer);
094    }
095
096    /**
097     * builds SearchKeyword without checking for non-null required values
098     * @return SearchKeyword
099     */
100    public SearchKeyword buildUnchecked() {
101        return new SearchKeywordImpl(text, suggestTokenizer);
102    }
103
104    /**
105     * factory method for an instance of SearchKeywordBuilder
106     * @return builder
107     */
108    public static SearchKeywordBuilder of() {
109        return new SearchKeywordBuilder();
110    }
111
112    /**
113     * create builder for SearchKeyword instance
114     * @param template instance with prefilled values for the builder
115     * @return builder
116     */
117    public static SearchKeywordBuilder of(final SearchKeyword template) {
118        SearchKeywordBuilder builder = new SearchKeywordBuilder();
119        builder.text = template.getText();
120        builder.suggestTokenizer = template.getSuggestTokenizer();
121        return builder;
122    }
123
124}