001 002package com.commercetools.api.models.error; 003 004import java.util.*; 005 006import javax.annotation.Nullable; 007 008import io.vrap.rmf.base.client.Builder; 009import io.vrap.rmf.base.client.utils.Generated; 010 011/** 012 * MissingTaxRateForCountryErrorBuilder 013 * <hr> 014 * Example to create an instance using the builder pattern 015 * <div class=code-example> 016 * <pre><code class='java'> 017 * MissingTaxRateForCountryError missingTaxRateForCountryError = MissingTaxRateForCountryError.builder() 018 * .message("{message}") 019 * .taxCategoryId("{taxCategoryId}") 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 MissingTaxRateForCountryErrorBuilder implements Builder<MissingTaxRateForCountryError> { 026 027 private String message; 028 029 private Map<String, java.lang.Object> values = new HashMap<>(); 030 031 private String taxCategoryId; 032 033 @Nullable 034 private String country; 035 036 @Nullable 037 private String state; 038 039 /** 040 * <p><code>"Tax category $taxCategoryId is missing a tax rate for country $countriesAndStates."</code></p> 041 * @param message value to be set 042 * @return Builder 043 */ 044 045 public MissingTaxRateForCountryErrorBuilder message(final String message) { 046 this.message = message; 047 return this; 048 } 049 050 /** 051 * <p>Error-specific additional fields.</p> 052 * @param values properties to be set 053 * @return Builder 054 */ 055 056 public MissingTaxRateForCountryErrorBuilder values(final Map<String, java.lang.Object> values) { 057 this.values = values; 058 return this; 059 } 060 061 /** 062 * <p>Error-specific additional fields.</p> 063 * @param key property name 064 * @param value property value 065 * @return Builder 066 */ 067 068 public MissingTaxRateForCountryErrorBuilder addValue(final String key, final java.lang.Object value) { 069 if (this.values == null) { 070 values = new HashMap<>(); 071 } 072 values.put(key, value); 073 return this; 074 } 075 076 /** 077 * <p>Unique identifier of the TaxCategory.</p> 078 * @param taxCategoryId value to be set 079 * @return Builder 080 */ 081 082 public MissingTaxRateForCountryErrorBuilder taxCategoryId(final String taxCategoryId) { 083 this.taxCategoryId = taxCategoryId; 084 return this; 085 } 086 087 /** 088 * <p>Country code of the geographic location.</p> 089 * @param country value to be set 090 * @return Builder 091 */ 092 093 public MissingTaxRateForCountryErrorBuilder country(@Nullable final String country) { 094 this.country = country; 095 return this; 096 } 097 098 /** 099 * <p>State within the country, such as Texas in the United States.</p> 100 * @param state value to be set 101 * @return Builder 102 */ 103 104 public MissingTaxRateForCountryErrorBuilder state(@Nullable final String state) { 105 this.state = state; 106 return this; 107 } 108 109 /** 110 * <p><code>"Tax category $taxCategoryId is missing a tax rate for country $countriesAndStates."</code></p> 111 * @return message 112 */ 113 114 public String getMessage() { 115 return this.message; 116 } 117 118 /** 119 * <p>Error-specific additional fields.</p> 120 * @return pattern properties 121 */ 122 123 public Map<String, java.lang.Object> getValues() { 124 return this.values; 125 } 126 127 /** 128 * <p>Unique identifier of the TaxCategory.</p> 129 * @return taxCategoryId 130 */ 131 132 public String getTaxCategoryId() { 133 return this.taxCategoryId; 134 } 135 136 /** 137 * <p>Country code of the geographic location.</p> 138 * @return country 139 */ 140 141 @Nullable 142 public String getCountry() { 143 return this.country; 144 } 145 146 /** 147 * <p>State within the country, such as Texas in the United States.</p> 148 * @return state 149 */ 150 151 @Nullable 152 public String getState() { 153 return this.state; 154 } 155 156 /** 157 * builds MissingTaxRateForCountryError with checking for non-null required values 158 * @return MissingTaxRateForCountryError 159 */ 160 public MissingTaxRateForCountryError build() { 161 Objects.requireNonNull(message, MissingTaxRateForCountryError.class + ": message is missing"); 162 Objects.requireNonNull(taxCategoryId, MissingTaxRateForCountryError.class + ": taxCategoryId is missing"); 163 return new MissingTaxRateForCountryErrorImpl(message, values, taxCategoryId, country, state); 164 } 165 166 /** 167 * builds MissingTaxRateForCountryError without checking for non-null required values 168 * @return MissingTaxRateForCountryError 169 */ 170 public MissingTaxRateForCountryError buildUnchecked() { 171 return new MissingTaxRateForCountryErrorImpl(message, values, taxCategoryId, country, state); 172 } 173 174 /** 175 * factory method for an instance of MissingTaxRateForCountryErrorBuilder 176 * @return builder 177 */ 178 public static MissingTaxRateForCountryErrorBuilder of() { 179 return new MissingTaxRateForCountryErrorBuilder(); 180 } 181 182 /** 183 * create builder for MissingTaxRateForCountryError instance 184 * @param template instance with prefilled values for the builder 185 * @return builder 186 */ 187 public static MissingTaxRateForCountryErrorBuilder of(final MissingTaxRateForCountryError template) { 188 MissingTaxRateForCountryErrorBuilder builder = new MissingTaxRateForCountryErrorBuilder(); 189 builder.message = template.getMessage(); 190 builder.values = template.values(); 191 builder.taxCategoryId = template.getTaxCategoryId(); 192 builder.country = template.getCountry(); 193 builder.state = template.getState(); 194 return builder; 195 } 196 197}