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