001 002package com.commercetools.history.models.common; 003 004import java.util.*; 005 006import io.vrap.rmf.base.client.Builder; 007import io.vrap.rmf.base.client.utils.Generated; 008 009/** 010 * TrackingDataBuilder 011 * <hr> 012 * Example to create an instance using the builder pattern 013 * <div class=code-example> 014 * <pre><code class='java'> 015 * TrackingData trackingData = TrackingData.builder() 016 * .trackingId("{trackingId}") 017 * .carrier("{carrier}") 018 * .provider("{provider}") 019 * .providerTransaction("{providerTransaction}") 020 * .isReturn(true) 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 TrackingDataBuilder implements Builder<TrackingData> { 027 028 private String trackingId; 029 030 private String carrier; 031 032 private String provider; 033 034 private String providerTransaction; 035 036 private Boolean isReturn; 037 038 /** 039 * <p>The ID to track one parcel.</p> 040 * @param trackingId value to be set 041 * @return Builder 042 */ 043 044 public TrackingDataBuilder trackingId(final String trackingId) { 045 this.trackingId = trackingId; 046 return this; 047 } 048 049 /** 050 * <p>The carrier that delivers the parcel.</p> 051 * @param carrier value to be set 052 * @return Builder 053 */ 054 055 public TrackingDataBuilder carrier(final String carrier) { 056 this.carrier = carrier; 057 return this; 058 } 059 060 /** 061 * set the value to the provider 062 * @param provider value to be set 063 * @return Builder 064 */ 065 066 public TrackingDataBuilder provider(final String provider) { 067 this.provider = provider; 068 return this; 069 } 070 071 /** 072 * set the value to the providerTransaction 073 * @param providerTransaction value to be set 074 * @return Builder 075 */ 076 077 public TrackingDataBuilder providerTransaction(final String providerTransaction) { 078 this.providerTransaction = providerTransaction; 079 return this; 080 } 081 082 /** 083 * <p>Flag to distinguish if the parcel is on the way to the customer (false) or on the way back (true).</p> 084 * @param isReturn value to be set 085 * @return Builder 086 */ 087 088 public TrackingDataBuilder isReturn(final Boolean isReturn) { 089 this.isReturn = isReturn; 090 return this; 091 } 092 093 /** 094 * <p>The ID to track one parcel.</p> 095 * @return trackingId 096 */ 097 098 public String getTrackingId() { 099 return this.trackingId; 100 } 101 102 /** 103 * <p>The carrier that delivers the parcel.</p> 104 * @return carrier 105 */ 106 107 public String getCarrier() { 108 return this.carrier; 109 } 110 111 /** 112 * value of provider} 113 * @return provider 114 */ 115 116 public String getProvider() { 117 return this.provider; 118 } 119 120 /** 121 * value of providerTransaction} 122 * @return providerTransaction 123 */ 124 125 public String getProviderTransaction() { 126 return this.providerTransaction; 127 } 128 129 /** 130 * <p>Flag to distinguish if the parcel is on the way to the customer (false) or on the way back (true).</p> 131 * @return isReturn 132 */ 133 134 public Boolean getIsReturn() { 135 return this.isReturn; 136 } 137 138 /** 139 * builds TrackingData with checking for non-null required values 140 * @return TrackingData 141 */ 142 public TrackingData build() { 143 Objects.requireNonNull(trackingId, TrackingData.class + ": trackingId is missing"); 144 Objects.requireNonNull(carrier, TrackingData.class + ": carrier is missing"); 145 Objects.requireNonNull(provider, TrackingData.class + ": provider is missing"); 146 Objects.requireNonNull(providerTransaction, TrackingData.class + ": providerTransaction is missing"); 147 Objects.requireNonNull(isReturn, TrackingData.class + ": isReturn is missing"); 148 return new TrackingDataImpl(trackingId, carrier, provider, providerTransaction, isReturn); 149 } 150 151 /** 152 * builds TrackingData without checking for non-null required values 153 * @return TrackingData 154 */ 155 public TrackingData buildUnchecked() { 156 return new TrackingDataImpl(trackingId, carrier, provider, providerTransaction, isReturn); 157 } 158 159 /** 160 * factory method for an instance of TrackingDataBuilder 161 * @return builder 162 */ 163 public static TrackingDataBuilder of() { 164 return new TrackingDataBuilder(); 165 } 166 167 /** 168 * create builder for TrackingData instance 169 * @param template instance with prefilled values for the builder 170 * @return builder 171 */ 172 public static TrackingDataBuilder of(final TrackingData template) { 173 TrackingDataBuilder builder = new TrackingDataBuilder(); 174 builder.trackingId = template.getTrackingId(); 175 builder.carrier = template.getCarrier(); 176 builder.provider = template.getProvider(); 177 builder.providerTransaction = template.getProviderTransaction(); 178 builder.isReturn = template.getIsReturn(); 179 return builder; 180 } 181 182}