001 002package com.commercetools.history.models.change_value; 003 004import java.util.*; 005import java.util.function.Function; 006 007import io.vrap.rmf.base.client.Builder; 008import io.vrap.rmf.base.client.utils.Generated; 009 010/** 011 * SetCartClassificationShippingRateInputValueBuilder 012 * <hr> 013 * Example to create an instance using the builder pattern 014 * <div class=code-example> 015 * <pre><code class='java'> 016 * SetCartClassificationShippingRateInputValue setCartClassificationShippingRateInputValue = SetCartClassificationShippingRateInputValue.builder() 017 * .type("{type}") 018 * .key("{key}") 019 * .label(labelBuilder -> labelBuilder) 020 * .build() 021 * </code></pre> 022 * </div> 023 */ 024@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 025public class SetCartClassificationShippingRateInputValueBuilder 026 implements Builder<SetCartClassificationShippingRateInputValue> { 027 028 private String type; 029 030 private String key; 031 032 private com.commercetools.history.models.common.LocalizedString label; 033 034 /** 035 * set the value to the type 036 * @param type value to be set 037 * @return Builder 038 */ 039 040 public SetCartClassificationShippingRateInputValueBuilder type(final String type) { 041 this.type = type; 042 return this; 043 } 044 045 /** 046 * <p>Key of the value used as a programmatic identifier.</p> 047 * @param key value to be set 048 * @return Builder 049 */ 050 051 public SetCartClassificationShippingRateInputValueBuilder key(final String key) { 052 this.key = key; 053 return this; 054 } 055 056 /** 057 * <p>Descriptive localized label of the value.</p> 058 * @param builder function to build the label value 059 * @return Builder 060 */ 061 062 public SetCartClassificationShippingRateInputValueBuilder label( 063 Function<com.commercetools.history.models.common.LocalizedStringBuilder, com.commercetools.history.models.common.LocalizedStringBuilder> builder) { 064 this.label = builder.apply(com.commercetools.history.models.common.LocalizedStringBuilder.of()).build(); 065 return this; 066 } 067 068 /** 069 * <p>Descriptive localized label of the value.</p> 070 * @param builder function to build the label value 071 * @return Builder 072 */ 073 074 public SetCartClassificationShippingRateInputValueBuilder withLabel( 075 Function<com.commercetools.history.models.common.LocalizedStringBuilder, com.commercetools.history.models.common.LocalizedString> builder) { 076 this.label = builder.apply(com.commercetools.history.models.common.LocalizedStringBuilder.of()); 077 return this; 078 } 079 080 /** 081 * <p>Descriptive localized label of the value.</p> 082 * @param label value to be set 083 * @return Builder 084 */ 085 086 public SetCartClassificationShippingRateInputValueBuilder label( 087 final com.commercetools.history.models.common.LocalizedString label) { 088 this.label = label; 089 return this; 090 } 091 092 /** 093 * value of type} 094 * @return type 095 */ 096 097 public String getType() { 098 return this.type; 099 } 100 101 /** 102 * <p>Key of the value used as a programmatic identifier.</p> 103 * @return key 104 */ 105 106 public String getKey() { 107 return this.key; 108 } 109 110 /** 111 * <p>Descriptive localized label of the value.</p> 112 * @return label 113 */ 114 115 public com.commercetools.history.models.common.LocalizedString getLabel() { 116 return this.label; 117 } 118 119 /** 120 * builds SetCartClassificationShippingRateInputValue with checking for non-null required values 121 * @return SetCartClassificationShippingRateInputValue 122 */ 123 public SetCartClassificationShippingRateInputValue build() { 124 Objects.requireNonNull(type, SetCartClassificationShippingRateInputValue.class + ": type is missing"); 125 Objects.requireNonNull(key, SetCartClassificationShippingRateInputValue.class + ": key is missing"); 126 Objects.requireNonNull(label, SetCartClassificationShippingRateInputValue.class + ": label is missing"); 127 return new SetCartClassificationShippingRateInputValueImpl(type, key, label); 128 } 129 130 /** 131 * builds SetCartClassificationShippingRateInputValue without checking for non-null required values 132 * @return SetCartClassificationShippingRateInputValue 133 */ 134 public SetCartClassificationShippingRateInputValue buildUnchecked() { 135 return new SetCartClassificationShippingRateInputValueImpl(type, key, label); 136 } 137 138 /** 139 * factory method for an instance of SetCartClassificationShippingRateInputValueBuilder 140 * @return builder 141 */ 142 public static SetCartClassificationShippingRateInputValueBuilder of() { 143 return new SetCartClassificationShippingRateInputValueBuilder(); 144 } 145 146 /** 147 * create builder for SetCartClassificationShippingRateInputValue instance 148 * @param template instance with prefilled values for the builder 149 * @return builder 150 */ 151 public static SetCartClassificationShippingRateInputValueBuilder of( 152 final SetCartClassificationShippingRateInputValue template) { 153 SetCartClassificationShippingRateInputValueBuilder builder = new SetCartClassificationShippingRateInputValueBuilder(); 154 builder.type = template.getType(); 155 builder.key = template.getKey(); 156 builder.label = template.getLabel(); 157 return builder; 158 } 159 160}