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 * ErrorByExtensionBuilder 013 * <hr> 014 * Example to create an instance using the builder pattern 015 * <div class=code-example> 016 * <pre><code class='java'> 017 * ErrorByExtension errorByExtension = ErrorByExtension.builder() 018 * .id("{id}") 019 * .build() 020 * </code></pre> 021 * </div> 022 */ 023@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 024public class ErrorByExtensionBuilder implements Builder<ErrorByExtension> { 025 026 private String id; 027 028 @Nullable 029 private String key; 030 031 /** 032 * <p>Unique identifier of the Extension.</p> 033 * @param id value to be set 034 * @return Builder 035 */ 036 037 public ErrorByExtensionBuilder id(final String id) { 038 this.id = id; 039 return this; 040 } 041 042 /** 043 * <p>User-defined unique identifier of the Extension.</p> 044 * @param key value to be set 045 * @return Builder 046 */ 047 048 public ErrorByExtensionBuilder key(@Nullable final String key) { 049 this.key = key; 050 return this; 051 } 052 053 /** 054 * <p>Unique identifier of the Extension.</p> 055 * @return id 056 */ 057 058 public String getId() { 059 return this.id; 060 } 061 062 /** 063 * <p>User-defined unique identifier of the Extension.</p> 064 * @return key 065 */ 066 067 @Nullable 068 public String getKey() { 069 return this.key; 070 } 071 072 /** 073 * builds ErrorByExtension with checking for non-null required values 074 * @return ErrorByExtension 075 */ 076 public ErrorByExtension build() { 077 Objects.requireNonNull(id, ErrorByExtension.class + ": id is missing"); 078 return new ErrorByExtensionImpl(id, key); 079 } 080 081 /** 082 * builds ErrorByExtension without checking for non-null required values 083 * @return ErrorByExtension 084 */ 085 public ErrorByExtension buildUnchecked() { 086 return new ErrorByExtensionImpl(id, key); 087 } 088 089 /** 090 * factory method for an instance of ErrorByExtensionBuilder 091 * @return builder 092 */ 093 public static ErrorByExtensionBuilder of() { 094 return new ErrorByExtensionBuilder(); 095 } 096 097 /** 098 * create builder for ErrorByExtension instance 099 * @param template instance with prefilled values for the builder 100 * @return builder 101 */ 102 public static ErrorByExtensionBuilder of(final ErrorByExtension template) { 103 ErrorByExtensionBuilder builder = new ErrorByExtensionBuilder(); 104 builder.id = template.getId(); 105 builder.key = template.getKey(); 106 return builder; 107 } 108 109}