001 002package com.commercetools.history.models.common; 003 004import java.util.*; 005import java.util.function.Function; 006 007import io.vrap.rmf.base.client.Builder; 008import io.vrap.rmf.base.client.utils.Generated; 009 010/** 011 * AssociateRoleAssignmentBuilder 012 * <hr> 013 * Example to create an instance using the builder pattern 014 * <div class=code-example> 015 * <pre><code class='java'> 016 * AssociateRoleAssignment associateRoleAssignment = AssociateRoleAssignment.builder() 017 * .associateRole(associateRoleBuilder -> associateRoleBuilder) 018 * .inheritance(AssociateRoleInheritanceMode.ENABLED) 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 AssociateRoleAssignmentBuilder implements Builder<AssociateRoleAssignment> { 025 026 private com.commercetools.history.models.common.KeyReference associateRole; 027 028 private com.commercetools.history.models.common.AssociateRoleInheritanceMode inheritance; 029 030 /** 031 * set the value to the associateRole using the builder function 032 * @param builder function to build the associateRole value 033 * @return Builder 034 */ 035 036 public AssociateRoleAssignmentBuilder associateRole( 037 Function<com.commercetools.history.models.common.KeyReferenceBuilder, com.commercetools.history.models.common.KeyReferenceBuilder> builder) { 038 this.associateRole = builder.apply(com.commercetools.history.models.common.KeyReferenceBuilder.of()).build(); 039 return this; 040 } 041 042 /** 043 * set the value to the associateRole using the builder function 044 * @param builder function to build the associateRole value 045 * @return Builder 046 */ 047 048 public AssociateRoleAssignmentBuilder withAssociateRole( 049 Function<com.commercetools.history.models.common.KeyReferenceBuilder, com.commercetools.history.models.common.KeyReference> builder) { 050 this.associateRole = builder.apply(com.commercetools.history.models.common.KeyReferenceBuilder.of()); 051 return this; 052 } 053 054 /** 055 * set the value to the associateRole 056 * @param associateRole value to be set 057 * @return Builder 058 */ 059 060 public AssociateRoleAssignmentBuilder associateRole( 061 final com.commercetools.history.models.common.KeyReference associateRole) { 062 this.associateRole = associateRole; 063 return this; 064 } 065 066 /** 067 * <p>Determines whether an AssociateRoleAssignment can be inherited by child Business Units.</p> 068 * @param inheritance value to be set 069 * @return Builder 070 */ 071 072 public AssociateRoleAssignmentBuilder inheritance( 073 final com.commercetools.history.models.common.AssociateRoleInheritanceMode inheritance) { 074 this.inheritance = inheritance; 075 return this; 076 } 077 078 /** 079 * value of associateRole} 080 * @return associateRole 081 */ 082 083 public com.commercetools.history.models.common.KeyReference getAssociateRole() { 084 return this.associateRole; 085 } 086 087 /** 088 * <p>Determines whether an AssociateRoleAssignment can be inherited by child Business Units.</p> 089 * @return inheritance 090 */ 091 092 public com.commercetools.history.models.common.AssociateRoleInheritanceMode getInheritance() { 093 return this.inheritance; 094 } 095 096 /** 097 * builds AssociateRoleAssignment with checking for non-null required values 098 * @return AssociateRoleAssignment 099 */ 100 public AssociateRoleAssignment build() { 101 Objects.requireNonNull(associateRole, AssociateRoleAssignment.class + ": associateRole is missing"); 102 Objects.requireNonNull(inheritance, AssociateRoleAssignment.class + ": inheritance is missing"); 103 return new AssociateRoleAssignmentImpl(associateRole, inheritance); 104 } 105 106 /** 107 * builds AssociateRoleAssignment without checking for non-null required values 108 * @return AssociateRoleAssignment 109 */ 110 public AssociateRoleAssignment buildUnchecked() { 111 return new AssociateRoleAssignmentImpl(associateRole, inheritance); 112 } 113 114 /** 115 * factory method for an instance of AssociateRoleAssignmentBuilder 116 * @return builder 117 */ 118 public static AssociateRoleAssignmentBuilder of() { 119 return new AssociateRoleAssignmentBuilder(); 120 } 121 122 /** 123 * create builder for AssociateRoleAssignment instance 124 * @param template instance with prefilled values for the builder 125 * @return builder 126 */ 127 public static AssociateRoleAssignmentBuilder of(final AssociateRoleAssignment template) { 128 AssociateRoleAssignmentBuilder builder = new AssociateRoleAssignmentBuilder(); 129 builder.associateRole = template.getAssociateRole(); 130 builder.inheritance = template.getInheritance(); 131 return builder; 132 } 133 134}