001
002package com.commercetools.history.models.common;
003
004import java.util.*;
005import java.util.function.Function;
006
007import io.vrap.rmf.base.client.Builder;
008import io.vrap.rmf.base.client.utils.Generated;
009
010/**
011 * AssetSourceBuilder
012 * <hr>
013 * Example to create an instance using the builder pattern
014 * <div class=code-example>
015 * <pre><code class='java'>
016 *     AssetSource assetSource = AssetSource.builder()
017 *             .uri("{uri}")
018 *             .key("{key}")
019 *             .dimensions(dimensionsBuilder -> dimensionsBuilder)
020 *             .contentType("{contentType}")
021 *             .build()
022 * </code></pre>
023 * </div>
024 */
025@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
026public class AssetSourceBuilder implements Builder<AssetSource> {
027
028    private String uri;
029
030    private String key;
031
032    private com.commercetools.history.models.common.AssetDimensions dimensions;
033
034    private String contentType;
035
036    /**
037     * set the value to the uri
038     * @param uri value to be set
039     * @return Builder
040     */
041
042    public AssetSourceBuilder uri(final String uri) {
043        this.uri = uri;
044        return this;
045    }
046
047    /**
048     * set the value to the key
049     * @param key value to be set
050     * @return Builder
051     */
052
053    public AssetSourceBuilder key(final String key) {
054        this.key = key;
055        return this;
056    }
057
058    /**
059     * set the value to the dimensions using the builder function
060     * @param builder function to build the dimensions value
061     * @return Builder
062     */
063
064    public AssetSourceBuilder dimensions(
065            Function<com.commercetools.history.models.common.AssetDimensionsBuilder, com.commercetools.history.models.common.AssetDimensionsBuilder> builder) {
066        this.dimensions = builder.apply(com.commercetools.history.models.common.AssetDimensionsBuilder.of()).build();
067        return this;
068    }
069
070    /**
071     * set the value to the dimensions using the builder function
072     * @param builder function to build the dimensions value
073     * @return Builder
074     */
075
076    public AssetSourceBuilder withDimensions(
077            Function<com.commercetools.history.models.common.AssetDimensionsBuilder, com.commercetools.history.models.common.AssetDimensions> builder) {
078        this.dimensions = builder.apply(com.commercetools.history.models.common.AssetDimensionsBuilder.of());
079        return this;
080    }
081
082    /**
083     * set the value to the dimensions
084     * @param dimensions value to be set
085     * @return Builder
086     */
087
088    public AssetSourceBuilder dimensions(final com.commercetools.history.models.common.AssetDimensions dimensions) {
089        this.dimensions = dimensions;
090        return this;
091    }
092
093    /**
094     * set the value to the contentType
095     * @param contentType value to be set
096     * @return Builder
097     */
098
099    public AssetSourceBuilder contentType(final String contentType) {
100        this.contentType = contentType;
101        return this;
102    }
103
104    /**
105     * value of uri}
106     * @return uri
107     */
108
109    public String getUri() {
110        return this.uri;
111    }
112
113    /**
114     * value of key}
115     * @return key
116     */
117
118    public String getKey() {
119        return this.key;
120    }
121
122    /**
123     * value of dimensions}
124     * @return dimensions
125     */
126
127    public com.commercetools.history.models.common.AssetDimensions getDimensions() {
128        return this.dimensions;
129    }
130
131    /**
132     * value of contentType}
133     * @return contentType
134     */
135
136    public String getContentType() {
137        return this.contentType;
138    }
139
140    /**
141     * builds AssetSource with checking for non-null required values
142     * @return AssetSource
143     */
144    public AssetSource build() {
145        Objects.requireNonNull(uri, AssetSource.class + ": uri is missing");
146        Objects.requireNonNull(key, AssetSource.class + ": key is missing");
147        Objects.requireNonNull(dimensions, AssetSource.class + ": dimensions is missing");
148        Objects.requireNonNull(contentType, AssetSource.class + ": contentType is missing");
149        return new AssetSourceImpl(uri, key, dimensions, contentType);
150    }
151
152    /**
153     * builds AssetSource without checking for non-null required values
154     * @return AssetSource
155     */
156    public AssetSource buildUnchecked() {
157        return new AssetSourceImpl(uri, key, dimensions, contentType);
158    }
159
160    /**
161     * factory method for an instance of AssetSourceBuilder
162     * @return builder
163     */
164    public static AssetSourceBuilder of() {
165        return new AssetSourceBuilder();
166    }
167
168    /**
169     * create builder for AssetSource instance
170     * @param template instance with prefilled values for the builder
171     * @return builder
172     */
173    public static AssetSourceBuilder of(final AssetSource template) {
174        AssetSourceBuilder builder = new AssetSourceBuilder();
175        builder.uri = template.getUri();
176        builder.key = template.getKey();
177        builder.dimensions = template.getDimensions();
178        builder.contentType = template.getContentType();
179        return builder;
180    }
181
182}