001 002package com.commercetools.api.models.channel; 003 004import java.util.*; 005 006import io.vrap.rmf.base.client.Builder; 007import io.vrap.rmf.base.client.utils.Generated; 008 009/** 010 * ChannelSetRolesActionBuilder 011 * <hr> 012 * Example to create an instance using the builder pattern 013 * <div class=code-example> 014 * <pre><code class='java'> 015 * ChannelSetRolesAction channelSetRolesAction = ChannelSetRolesAction.builder() 016 * .plusRoles(rolesBuilder -> rolesBuilder) 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 ChannelSetRolesActionBuilder implements Builder<ChannelSetRolesAction> { 023 024 private java.util.List<com.commercetools.api.models.channel.ChannelRoleEnum> roles; 025 026 /** 027 * <p>Value to set. If not specified, then <code>InventorySupply</code> is assigned by default.</p> 028 * @param roles value to be set 029 * @return Builder 030 */ 031 032 public ChannelSetRolesActionBuilder roles(final com.commercetools.api.models.channel.ChannelRoleEnum... roles) { 033 this.roles = new ArrayList<>(Arrays.asList(roles)); 034 return this; 035 } 036 037 /** 038 * <p>Value to set. If not specified, then <code>InventorySupply</code> is assigned by default.</p> 039 * @param roles value to be set 040 * @return Builder 041 */ 042 043 public ChannelSetRolesActionBuilder roles( 044 final java.util.List<com.commercetools.api.models.channel.ChannelRoleEnum> roles) { 045 this.roles = roles; 046 return this; 047 } 048 049 /** 050 * <p>Value to set. If not specified, then <code>InventorySupply</code> is assigned by default.</p> 051 * @param roles value to be set 052 * @return Builder 053 */ 054 055 public ChannelSetRolesActionBuilder plusRoles(final com.commercetools.api.models.channel.ChannelRoleEnum... roles) { 056 if (this.roles == null) { 057 this.roles = new ArrayList<>(); 058 } 059 this.roles.addAll(Arrays.asList(roles)); 060 return this; 061 } 062 063 /** 064 * <p>Value to set. If not specified, then <code>InventorySupply</code> is assigned by default.</p> 065 * @return roles 066 */ 067 068 public java.util.List<com.commercetools.api.models.channel.ChannelRoleEnum> getRoles() { 069 return this.roles; 070 } 071 072 /** 073 * builds ChannelSetRolesAction with checking for non-null required values 074 * @return ChannelSetRolesAction 075 */ 076 public ChannelSetRolesAction build() { 077 Objects.requireNonNull(roles, ChannelSetRolesAction.class + ": roles is missing"); 078 return new ChannelSetRolesActionImpl(roles); 079 } 080 081 /** 082 * builds ChannelSetRolesAction without checking for non-null required values 083 * @return ChannelSetRolesAction 084 */ 085 public ChannelSetRolesAction buildUnchecked() { 086 return new ChannelSetRolesActionImpl(roles); 087 } 088 089 /** 090 * factory method for an instance of ChannelSetRolesActionBuilder 091 * @return builder 092 */ 093 public static ChannelSetRolesActionBuilder of() { 094 return new ChannelSetRolesActionBuilder(); 095 } 096 097 /** 098 * create builder for ChannelSetRolesAction instance 099 * @param template instance with prefilled values for the builder 100 * @return builder 101 */ 102 public static ChannelSetRolesActionBuilder of(final ChannelSetRolesAction template) { 103 ChannelSetRolesActionBuilder builder = new ChannelSetRolesActionBuilder(); 104 builder.roles = template.getRoles(); 105 return builder; 106 } 107 108}