001
002package com.commercetools.history.models.label;
003
004import java.util.*;
005
006import io.vrap.rmf.base.client.Builder;
007import io.vrap.rmf.base.client.utils.Generated;
008
009/**
010 * OrderLabelBuilder
011 * <hr>
012 * Example to create an instance using the builder pattern
013 * <div class=code-example>
014 * <pre><code class='java'>
015 *     OrderLabel orderLabel = OrderLabel.builder()
016 *             .customerEmail("{customerEmail}")
017 *             .orderNumber("{orderNumber}")
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 OrderLabelBuilder implements Builder<OrderLabel> {
024
025    private String customerEmail;
026
027    private String orderNumber;
028
029    /**
030     *  <p>Email address of the Customer that the Order belongs to.</p>
031     * @param customerEmail value to be set
032     * @return Builder
033     */
034
035    public OrderLabelBuilder customerEmail(final String customerEmail) {
036        this.customerEmail = customerEmail;
037        return this;
038    }
039
040    /**
041     *  <p>User-defined unique identifier of the Order that is unique across a Project.</p>
042     * @param orderNumber value to be set
043     * @return Builder
044     */
045
046    public OrderLabelBuilder orderNumber(final String orderNumber) {
047        this.orderNumber = orderNumber;
048        return this;
049    }
050
051    /**
052     *  <p>Email address of the Customer that the Order belongs to.</p>
053     * @return customerEmail
054     */
055
056    public String getCustomerEmail() {
057        return this.customerEmail;
058    }
059
060    /**
061     *  <p>User-defined unique identifier of the Order that is unique across a Project.</p>
062     * @return orderNumber
063     */
064
065    public String getOrderNumber() {
066        return this.orderNumber;
067    }
068
069    /**
070     * builds OrderLabel with checking for non-null required values
071     * @return OrderLabel
072     */
073    public OrderLabel build() {
074        Objects.requireNonNull(customerEmail, OrderLabel.class + ": customerEmail is missing");
075        Objects.requireNonNull(orderNumber, OrderLabel.class + ": orderNumber is missing");
076        return new OrderLabelImpl(customerEmail, orderNumber);
077    }
078
079    /**
080     * builds OrderLabel without checking for non-null required values
081     * @return OrderLabel
082     */
083    public OrderLabel buildUnchecked() {
084        return new OrderLabelImpl(customerEmail, orderNumber);
085    }
086
087    /**
088     * factory method for an instance of OrderLabelBuilder
089     * @return builder
090     */
091    public static OrderLabelBuilder of() {
092        return new OrderLabelBuilder();
093    }
094
095    /**
096     * create builder for OrderLabel instance
097     * @param template instance with prefilled values for the builder
098     * @return builder
099     */
100    public static OrderLabelBuilder of(final OrderLabel template) {
101        OrderLabelBuilder builder = new OrderLabelBuilder();
102        builder.customerEmail = template.getCustomerEmail();
103        builder.orderNumber = template.getOrderNumber();
104        return builder;
105    }
106
107}