001 002package com.commercetools.api.models.associate_role; 003 004import java.util.*; 005import java.util.function.Function; 006 007import javax.annotation.Nullable; 008 009import io.vrap.rmf.base.client.Builder; 010import io.vrap.rmf.base.client.utils.Generated; 011 012/** 013 * AssociateRoleReferenceBuilder 014 * <hr> 015 * Example to create an instance using the builder pattern 016 * <div class=code-example> 017 * <pre><code class='java'> 018 * AssociateRoleReference associateRoleReference = AssociateRoleReference.builder() 019 * .id("{id}") 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 AssociateRoleReferenceBuilder implements Builder<AssociateRoleReference> { 026 027 private String id; 028 029 @Nullable 030 private com.commercetools.api.models.associate_role.AssociateRole obj; 031 032 /** 033 * <p>Unique identifier of the referenced AssociateRole.</p> 034 * @param id value to be set 035 * @return Builder 036 */ 037 038 public AssociateRoleReferenceBuilder id(final String id) { 039 this.id = id; 040 return this; 041 } 042 043 /** 044 * <p>Contains the representation of the expanded AssociateRole. Only present in responses to requests with Reference Expansion for AssociateRole.</p> 045 * @param builder function to build the obj value 046 * @return Builder 047 */ 048 049 public AssociateRoleReferenceBuilder obj( 050 Function<com.commercetools.api.models.associate_role.AssociateRoleBuilder, com.commercetools.api.models.associate_role.AssociateRoleBuilder> builder) { 051 this.obj = builder.apply(com.commercetools.api.models.associate_role.AssociateRoleBuilder.of()).build(); 052 return this; 053 } 054 055 /** 056 * <p>Contains the representation of the expanded AssociateRole. Only present in responses to requests with Reference Expansion for AssociateRole.</p> 057 * @param builder function to build the obj value 058 * @return Builder 059 */ 060 061 public AssociateRoleReferenceBuilder withObj( 062 Function<com.commercetools.api.models.associate_role.AssociateRoleBuilder, com.commercetools.api.models.associate_role.AssociateRole> builder) { 063 this.obj = builder.apply(com.commercetools.api.models.associate_role.AssociateRoleBuilder.of()); 064 return this; 065 } 066 067 /** 068 * <p>Contains the representation of the expanded AssociateRole. Only present in responses to requests with Reference Expansion for AssociateRole.</p> 069 * @param obj value to be set 070 * @return Builder 071 */ 072 073 public AssociateRoleReferenceBuilder obj( 074 @Nullable final com.commercetools.api.models.associate_role.AssociateRole obj) { 075 this.obj = obj; 076 return this; 077 } 078 079 /** 080 * <p>Unique identifier of the referenced AssociateRole.</p> 081 * @return id 082 */ 083 084 public String getId() { 085 return this.id; 086 } 087 088 /** 089 * <p>Contains the representation of the expanded AssociateRole. Only present in responses to requests with Reference Expansion for AssociateRole.</p> 090 * @return obj 091 */ 092 093 @Nullable 094 public com.commercetools.api.models.associate_role.AssociateRole getObj() { 095 return this.obj; 096 } 097 098 /** 099 * builds AssociateRoleReference with checking for non-null required values 100 * @return AssociateRoleReference 101 */ 102 public AssociateRoleReference build() { 103 Objects.requireNonNull(id, AssociateRoleReference.class + ": id is missing"); 104 return new AssociateRoleReferenceImpl(id, obj); 105 } 106 107 /** 108 * builds AssociateRoleReference without checking for non-null required values 109 * @return AssociateRoleReference 110 */ 111 public AssociateRoleReference buildUnchecked() { 112 return new AssociateRoleReferenceImpl(id, obj); 113 } 114 115 /** 116 * factory method for an instance of AssociateRoleReferenceBuilder 117 * @return builder 118 */ 119 public static AssociateRoleReferenceBuilder of() { 120 return new AssociateRoleReferenceBuilder(); 121 } 122 123 /** 124 * create builder for AssociateRoleReference instance 125 * @param template instance with prefilled values for the builder 126 * @return builder 127 */ 128 public static AssociateRoleReferenceBuilder of(final AssociateRoleReference template) { 129 AssociateRoleReferenceBuilder builder = new AssociateRoleReferenceBuilder(); 130 builder.id = template.getId(); 131 builder.obj = template.getObj(); 132 return builder; 133 } 134 135}