com.commercetools.history.models.label.OrderLabelBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of commercetools-sdk-java-history Show documentation
Show all versions of commercetools-sdk-java-history Show documentation
The e-commerce SDK from commercetools Composable Commerce for Java
package com.commercetools.history.models.label;
import java.util.*;
import io.vrap.rmf.base.client.Builder;
import io.vrap.rmf.base.client.utils.Generated;
/**
* OrderLabelBuilder
*
* Example to create an instance using the builder pattern
*
*
* OrderLabel orderLabel = OrderLabel.builder()
* .customerEmail("{customerEmail}")
* .orderNumber("{orderNumber}")
* .build()
*
*
*/
@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
public class OrderLabelBuilder implements Builder {
private String customerEmail;
private String orderNumber;
/**
* Email address of the Customer that the Order belongs to.
* @param customerEmail value to be set
* @return Builder
*/
public OrderLabelBuilder customerEmail(final String customerEmail) {
this.customerEmail = customerEmail;
return this;
}
/**
* User-defined unique identifier of the Order that is unique across a Project.
* @param orderNumber value to be set
* @return Builder
*/
public OrderLabelBuilder orderNumber(final String orderNumber) {
this.orderNumber = orderNumber;
return this;
}
/**
* Email address of the Customer that the Order belongs to.
* @return customerEmail
*/
public String getCustomerEmail() {
return this.customerEmail;
}
/**
* User-defined unique identifier of the Order that is unique across a Project.
* @return orderNumber
*/
public String getOrderNumber() {
return this.orderNumber;
}
/**
* builds OrderLabel with checking for non-null required values
* @return OrderLabel
*/
public OrderLabel build() {
Objects.requireNonNull(customerEmail, OrderLabel.class + ": customerEmail is missing");
Objects.requireNonNull(orderNumber, OrderLabel.class + ": orderNumber is missing");
return new OrderLabelImpl(customerEmail, orderNumber);
}
/**
* builds OrderLabel without checking for non-null required values
* @return OrderLabel
*/
public OrderLabel buildUnchecked() {
return new OrderLabelImpl(customerEmail, orderNumber);
}
/**
* factory method for an instance of OrderLabelBuilder
* @return builder
*/
public static OrderLabelBuilder of() {
return new OrderLabelBuilder();
}
/**
* create builder for OrderLabel instance
* @param template instance with prefilled values for the builder
* @return builder
*/
public static OrderLabelBuilder of(final OrderLabel template) {
OrderLabelBuilder builder = new OrderLabelBuilder();
builder.customerEmail = template.getCustomerEmail();
builder.orderNumber = template.getOrderNumber();
return builder;
}
}