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 * ShippingRatePriceTierBuilder 011 * <hr> 012 * Example to create an instance using the builder pattern 013 * <div class=code-example> 014 * <pre><code class='java'> 015 * ShippingRatePriceTier shippingRatePriceTier = ShippingRatePriceTier.builder() 016 * .type(ShippingRateTierType.CART_VALUE) 017 * .build() 018 * </code></pre> 019 * </div> 020 */ 021@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 022public class ShippingRatePriceTierBuilder implements Builder<ShippingRatePriceTier> { 023 024 private com.commercetools.history.models.common.ShippingRateTierType type; 025 026 /** 027 * set the value to the type 028 * @param type value to be set 029 * @return Builder 030 */ 031 032 public ShippingRatePriceTierBuilder type(final com.commercetools.history.models.common.ShippingRateTierType type) { 033 this.type = type; 034 return this; 035 } 036 037 /** 038 * value of type} 039 * @return type 040 */ 041 042 public com.commercetools.history.models.common.ShippingRateTierType getType() { 043 return this.type; 044 } 045 046 /** 047 * builds ShippingRatePriceTier with checking for non-null required values 048 * @return ShippingRatePriceTier 049 */ 050 public ShippingRatePriceTier build() { 051 Objects.requireNonNull(type, ShippingRatePriceTier.class + ": type is missing"); 052 return new ShippingRatePriceTierImpl(type); 053 } 054 055 /** 056 * builds ShippingRatePriceTier without checking for non-null required values 057 * @return ShippingRatePriceTier 058 */ 059 public ShippingRatePriceTier buildUnchecked() { 060 return new ShippingRatePriceTierImpl(type); 061 } 062 063 /** 064 * factory method for an instance of ShippingRatePriceTierBuilder 065 * @return builder 066 */ 067 public static ShippingRatePriceTierBuilder of() { 068 return new ShippingRatePriceTierBuilder(); 069 } 070 071 /** 072 * create builder for ShippingRatePriceTier instance 073 * @param template instance with prefilled values for the builder 074 * @return builder 075 */ 076 public static ShippingRatePriceTierBuilder of(final ShippingRatePriceTier template) { 077 ShippingRatePriceTierBuilder builder = new ShippingRatePriceTierBuilder(); 078 builder.type = template.getType(); 079 return builder; 080 } 081 082}