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 * CustomerLabelBuilder 011 * <hr> 012 * Example to create an instance using the builder pattern 013 * <div class=code-example> 014 * <pre><code class='java'> 015 * CustomerLabel customerLabel = CustomerLabel.builder() 016 * .firstName("{firstName}") 017 * .lastName("{lastName}") 018 * .customerNumber("{customerNumber}") 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 CustomerLabelBuilder implements Builder<CustomerLabel> { 025 026 private String firstName; 027 028 private String lastName; 029 030 private String customerNumber; 031 032 /** 033 * <p>Given name (first name) of the Customer.</p> 034 * @param firstName value to be set 035 * @return Builder 036 */ 037 038 public CustomerLabelBuilder firstName(final String firstName) { 039 this.firstName = firstName; 040 return this; 041 } 042 043 /** 044 * <p>Family name (last name) of the Customer.</p> 045 * @param lastName value to be set 046 * @return Builder 047 */ 048 049 public CustomerLabelBuilder lastName(final String lastName) { 050 this.lastName = lastName; 051 return this; 052 } 053 054 /** 055 * <p>User-defined unique identifier of the Customer.</p> 056 * @param customerNumber value to be set 057 * @return Builder 058 */ 059 060 public CustomerLabelBuilder customerNumber(final String customerNumber) { 061 this.customerNumber = customerNumber; 062 return this; 063 } 064 065 /** 066 * <p>Given name (first name) of the Customer.</p> 067 * @return firstName 068 */ 069 070 public String getFirstName() { 071 return this.firstName; 072 } 073 074 /** 075 * <p>Family name (last name) of the Customer.</p> 076 * @return lastName 077 */ 078 079 public String getLastName() { 080 return this.lastName; 081 } 082 083 /** 084 * <p>User-defined unique identifier of the Customer.</p> 085 * @return customerNumber 086 */ 087 088 public String getCustomerNumber() { 089 return this.customerNumber; 090 } 091 092 /** 093 * builds CustomerLabel with checking for non-null required values 094 * @return CustomerLabel 095 */ 096 public CustomerLabel build() { 097 Objects.requireNonNull(firstName, CustomerLabel.class + ": firstName is missing"); 098 Objects.requireNonNull(lastName, CustomerLabel.class + ": lastName is missing"); 099 Objects.requireNonNull(customerNumber, CustomerLabel.class + ": customerNumber is missing"); 100 return new CustomerLabelImpl(firstName, lastName, customerNumber); 101 } 102 103 /** 104 * builds CustomerLabel without checking for non-null required values 105 * @return CustomerLabel 106 */ 107 public CustomerLabel buildUnchecked() { 108 return new CustomerLabelImpl(firstName, lastName, customerNumber); 109 } 110 111 /** 112 * factory method for an instance of CustomerLabelBuilder 113 * @return builder 114 */ 115 public static CustomerLabelBuilder of() { 116 return new CustomerLabelBuilder(); 117 } 118 119 /** 120 * create builder for CustomerLabel instance 121 * @param template instance with prefilled values for the builder 122 * @return builder 123 */ 124 public static CustomerLabelBuilder of(final CustomerLabel template) { 125 CustomerLabelBuilder builder = new CustomerLabelBuilder(); 126 builder.firstName = template.getFirstName(); 127 builder.lastName = template.getLastName(); 128 builder.customerNumber = template.getCustomerNumber(); 129 return builder; 130 } 131 132}