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 * StoreCountryBuilder 011 * <hr> 012 * Example to create an instance using the builder pattern 013 * <div class=code-example> 014 * <pre><code class='java'> 015 * StoreCountry storeCountry = StoreCountry.builder() 016 * .code("{code}") 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 StoreCountryBuilder implements Builder<StoreCountry> { 023 024 private String code; 025 026 /** 027 * <p>Two-digit country code as per ISO 3166-1 alpha-2.</p> 028 * @param code value to be set 029 * @return Builder 030 */ 031 032 public StoreCountryBuilder code(final String code) { 033 this.code = code; 034 return this; 035 } 036 037 /** 038 * <p>Two-digit country code as per ISO 3166-1 alpha-2.</p> 039 * @return code 040 */ 041 042 public String getCode() { 043 return this.code; 044 } 045 046 /** 047 * builds StoreCountry with checking for non-null required values 048 * @return StoreCountry 049 */ 050 public StoreCountry build() { 051 Objects.requireNonNull(code, StoreCountry.class + ": code is missing"); 052 return new StoreCountryImpl(code); 053 } 054 055 /** 056 * builds StoreCountry without checking for non-null required values 057 * @return StoreCountry 058 */ 059 public StoreCountry buildUnchecked() { 060 return new StoreCountryImpl(code); 061 } 062 063 /** 064 * factory method for an instance of StoreCountryBuilder 065 * @return builder 066 */ 067 public static StoreCountryBuilder of() { 068 return new StoreCountryBuilder(); 069 } 070 071 /** 072 * create builder for StoreCountry instance 073 * @param template instance with prefilled values for the builder 074 * @return builder 075 */ 076 public static StoreCountryBuilder of(final StoreCountry template) { 077 StoreCountryBuilder builder = new StoreCountryBuilder(); 078 builder.code = template.getCode(); 079 return builder; 080 } 081 082}