001
002package com.commercetools.api.models.product;
003
004import java.util.*;
005
006import io.vrap.rmf.base.client.Builder;
007import io.vrap.rmf.base.client.utils.Generated;
008
009/**
010 * SuggestionBuilder
011 * <hr>
012 * Example to create an instance using the builder pattern
013 * <div class=code-example>
014 * <pre><code class='java'>
015 *     Suggestion suggestion = Suggestion.builder()
016 *             .text("{text}")
017 *             .build()
018 * </code></pre>
019 * </div>
020 */
021@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
022public class SuggestionBuilder implements Builder<Suggestion> {
023
024    private String text;
025
026    /**
027     *  <p>The suggested text.</p>
028     * @param text value to be set
029     * @return Builder
030     */
031
032    public SuggestionBuilder text(final String text) {
033        this.text = text;
034        return this;
035    }
036
037    /**
038     *  <p>The suggested text.</p>
039     * @return text
040     */
041
042    public String getText() {
043        return this.text;
044    }
045
046    /**
047     * builds Suggestion with checking for non-null required values
048     * @return Suggestion
049     */
050    public Suggestion build() {
051        Objects.requireNonNull(text, Suggestion.class + ": text is missing");
052        return new SuggestionImpl(text);
053    }
054
055    /**
056     * builds Suggestion without checking for non-null required values
057     * @return Suggestion
058     */
059    public Suggestion buildUnchecked() {
060        return new SuggestionImpl(text);
061    }
062
063    /**
064     * factory method for an instance of SuggestionBuilder
065     * @return builder
066     */
067    public static SuggestionBuilder of() {
068        return new SuggestionBuilder();
069    }
070
071    /**
072     * create builder for Suggestion instance
073     * @param template instance with prefilled values for the builder
074     * @return builder
075     */
076    public static SuggestionBuilder of(final Suggestion template) {
077        SuggestionBuilder builder = new SuggestionBuilder();
078        builder.text = template.getText();
079        return builder;
080    }
081
082}