001
002package com.commercetools.history.models.change_value;
003
004import java.util.*;
005
006import io.vrap.rmf.base.client.Builder;
007import io.vrap.rmf.base.client.utils.Generated;
008
009/**
010 * ValidFromAndUntilValueBuilder
011 * <hr>
012 * Example to create an instance using the builder pattern
013 * <div class=code-example>
014 * <pre><code class='java'>
015 *     ValidFromAndUntilValue validFromAndUntilValue = ValidFromAndUntilValue.builder()
016 *             .validFrom("{validFrom}")
017 *             .validUntil("{validUntil}")
018 *             .build()
019 * </code></pre>
020 * </div>
021 */
022@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
023public class ValidFromAndUntilValueBuilder implements Builder<ValidFromAndUntilValue> {
024
025    private String validFrom;
026
027    private String validUntil;
028
029    /**
030     *  <p>Date and time (UTC) from when the Discount is effective.</p>
031     * @param validFrom value to be set
032     * @return Builder
033     */
034
035    public ValidFromAndUntilValueBuilder validFrom(final String validFrom) {
036        this.validFrom = validFrom;
037        return this;
038    }
039
040    /**
041     *  <p>Date and time (UTC) until when the Discount is effective.</p>
042     * @param validUntil value to be set
043     * @return Builder
044     */
045
046    public ValidFromAndUntilValueBuilder validUntil(final String validUntil) {
047        this.validUntil = validUntil;
048        return this;
049    }
050
051    /**
052     *  <p>Date and time (UTC) from when the Discount is effective.</p>
053     * @return validFrom
054     */
055
056    public String getValidFrom() {
057        return this.validFrom;
058    }
059
060    /**
061     *  <p>Date and time (UTC) until when the Discount is effective.</p>
062     * @return validUntil
063     */
064
065    public String getValidUntil() {
066        return this.validUntil;
067    }
068
069    /**
070     * builds ValidFromAndUntilValue with checking for non-null required values
071     * @return ValidFromAndUntilValue
072     */
073    public ValidFromAndUntilValue build() {
074        Objects.requireNonNull(validFrom, ValidFromAndUntilValue.class + ": validFrom is missing");
075        Objects.requireNonNull(validUntil, ValidFromAndUntilValue.class + ": validUntil is missing");
076        return new ValidFromAndUntilValueImpl(validFrom, validUntil);
077    }
078
079    /**
080     * builds ValidFromAndUntilValue without checking for non-null required values
081     * @return ValidFromAndUntilValue
082     */
083    public ValidFromAndUntilValue buildUnchecked() {
084        return new ValidFromAndUntilValueImpl(validFrom, validUntil);
085    }
086
087    /**
088     * factory method for an instance of ValidFromAndUntilValueBuilder
089     * @return builder
090     */
091    public static ValidFromAndUntilValueBuilder of() {
092        return new ValidFromAndUntilValueBuilder();
093    }
094
095    /**
096     * create builder for ValidFromAndUntilValue instance
097     * @param template instance with prefilled values for the builder
098     * @return builder
099     */
100    public static ValidFromAndUntilValueBuilder of(final ValidFromAndUntilValue template) {
101        ValidFromAndUntilValueBuilder builder = new ValidFromAndUntilValueBuilder();
102        builder.validFrom = template.getValidFrom();
103        builder.validUntil = template.getValidUntil();
104        return builder;
105    }
106
107}