001
002package com.commercetools.api.models.product;
003
004import java.util.*;
005
006import javax.annotation.Nullable;
007
008import io.vrap.rmf.base.client.Builder;
009import io.vrap.rmf.base.client.utils.Generated;
010
011/**
012 * FacetTermBuilder
013 * <hr>
014 * Example to create an instance using the builder pattern
015 * <div class=code-example>
016 * <pre><code class='java'>
017 *     FacetTerm facetTerm = FacetTerm.builder()
018 *             .count(0.3)
019 *             .build()
020 * </code></pre>
021 * </div>
022 */
023@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
024public class FacetTermBuilder implements Builder<FacetTerm> {
025
026    private java.lang.Object term;
027
028    private Long count;
029
030    @Nullable
031    private Long productCount;
032
033    /**
034     * set the value to the term
035     * @param term value to be set
036     * @return Builder
037     */
038
039    public FacetTermBuilder term(final java.lang.Object term) {
040        this.term = term;
041        return this;
042    }
043
044    /**
045     * set the value to the count
046     * @param count value to be set
047     * @return Builder
048     */
049
050    public FacetTermBuilder count(final Long count) {
051        this.count = count;
052        return this;
053    }
054
055    /**
056     * set the value to the productCount
057     * @param productCount value to be set
058     * @return Builder
059     */
060
061    public FacetTermBuilder productCount(@Nullable final Long productCount) {
062        this.productCount = productCount;
063        return this;
064    }
065
066    /**
067     * value of term}
068     * @return term
069     */
070
071    public java.lang.Object getTerm() {
072        return this.term;
073    }
074
075    /**
076     * value of count}
077     * @return count
078     */
079
080    public Long getCount() {
081        return this.count;
082    }
083
084    /**
085     * value of productCount}
086     * @return productCount
087     */
088
089    @Nullable
090    public Long getProductCount() {
091        return this.productCount;
092    }
093
094    /**
095     * builds FacetTerm with checking for non-null required values
096     * @return FacetTerm
097     */
098    public FacetTerm build() {
099        Objects.requireNonNull(term, FacetTerm.class + ": term is missing");
100        Objects.requireNonNull(count, FacetTerm.class + ": count is missing");
101        return new FacetTermImpl(term, count, productCount);
102    }
103
104    /**
105     * builds FacetTerm without checking for non-null required values
106     * @return FacetTerm
107     */
108    public FacetTerm buildUnchecked() {
109        return new FacetTermImpl(term, count, productCount);
110    }
111
112    /**
113     * factory method for an instance of FacetTermBuilder
114     * @return builder
115     */
116    public static FacetTermBuilder of() {
117        return new FacetTermBuilder();
118    }
119
120    /**
121     * create builder for FacetTerm instance
122     * @param template instance with prefilled values for the builder
123     * @return builder
124     */
125    public static FacetTermBuilder of(final FacetTerm template) {
126        FacetTermBuilder builder = new FacetTermBuilder();
127        builder.term = template.getTerm();
128        builder.count = template.getCount();
129        builder.productCount = template.getProductCount();
130        return builder;
131    }
132
133}