001 002package com.commercetools.api.models.error; 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 * GraphQLMissingRoleOnChannelErrorBuilder 014 * <hr> 015 * Example to create an instance using the builder pattern 016 * <div class=code-example> 017 * <pre><code class='java'> 018 * GraphQLMissingRoleOnChannelError graphQLMissingRoleOnChannelError = GraphQLMissingRoleOnChannelError.builder() 019 * .missingRole(ChannelRoleEnum.INVENTORY_SUPPLY) 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 GraphQLMissingRoleOnChannelErrorBuilder implements Builder<GraphQLMissingRoleOnChannelError> { 026 027 private Map<String, java.lang.Object> values = new HashMap<>(); 028 029 @Nullable 030 private com.commercetools.api.models.channel.ChannelResourceIdentifier channel; 031 032 private com.commercetools.api.models.channel.ChannelRoleEnum missingRole; 033 034 /** 035 * <p>Error-specific additional fields.</p> 036 * @param values properties to be set 037 * @return Builder 038 */ 039 040 public GraphQLMissingRoleOnChannelErrorBuilder values(final Map<String, java.lang.Object> values) { 041 this.values = values; 042 return this; 043 } 044 045 /** 046 * <p>Error-specific additional fields.</p> 047 * @param key property name 048 * @param value property value 049 * @return Builder 050 */ 051 052 public GraphQLMissingRoleOnChannelErrorBuilder addValue(final String key, final java.lang.Object value) { 053 if (this.values == null) { 054 values = new HashMap<>(); 055 } 056 values.put(key, value); 057 return this; 058 } 059 060 /** 061 * <p>ResourceIdentifier to a given Channel.</p> 062 * @param builder function to build the channel value 063 * @return Builder 064 */ 065 066 public GraphQLMissingRoleOnChannelErrorBuilder channel( 067 Function<com.commercetools.api.models.channel.ChannelResourceIdentifierBuilder, com.commercetools.api.models.channel.ChannelResourceIdentifierBuilder> builder) { 068 this.channel = builder.apply(com.commercetools.api.models.channel.ChannelResourceIdentifierBuilder.of()) 069 .build(); 070 return this; 071 } 072 073 /** 074 * <p>ResourceIdentifier to a given Channel.</p> 075 * @param builder function to build the channel value 076 * @return Builder 077 */ 078 079 public GraphQLMissingRoleOnChannelErrorBuilder withChannel( 080 Function<com.commercetools.api.models.channel.ChannelResourceIdentifierBuilder, com.commercetools.api.models.channel.ChannelResourceIdentifier> builder) { 081 this.channel = builder.apply(com.commercetools.api.models.channel.ChannelResourceIdentifierBuilder.of()); 082 return this; 083 } 084 085 /** 086 * <p>ResourceIdentifier to a given Channel.</p> 087 * @param channel value to be set 088 * @return Builder 089 */ 090 091 public GraphQLMissingRoleOnChannelErrorBuilder channel( 092 @Nullable final com.commercetools.api.models.channel.ChannelResourceIdentifier channel) { 093 this.channel = channel; 094 return this; 095 } 096 097 /** 098 * <ul> 099 * <li><code>ProductDistribution</code> for Product Distribution Channels allowed for the Store. Also required for Standalone Prices.</li> 100 * <li><code>InventorySupply</code> for Inventory Supply Channels allowed for the Store.</li> 101 * </ul> 102 * @param missingRole value to be set 103 * @return Builder 104 */ 105 106 public GraphQLMissingRoleOnChannelErrorBuilder missingRole( 107 final com.commercetools.api.models.channel.ChannelRoleEnum missingRole) { 108 this.missingRole = missingRole; 109 return this; 110 } 111 112 /** 113 * <p>Error-specific additional fields.</p> 114 * @return pattern properties 115 */ 116 117 public Map<String, java.lang.Object> getValues() { 118 return this.values; 119 } 120 121 /** 122 * <p>ResourceIdentifier to a given Channel.</p> 123 * @return channel 124 */ 125 126 @Nullable 127 public com.commercetools.api.models.channel.ChannelResourceIdentifier getChannel() { 128 return this.channel; 129 } 130 131 /** 132 * <ul> 133 * <li><code>ProductDistribution</code> for Product Distribution Channels allowed for the Store. Also required for Standalone Prices.</li> 134 * <li><code>InventorySupply</code> for Inventory Supply Channels allowed for the Store.</li> 135 * </ul> 136 * @return missingRole 137 */ 138 139 public com.commercetools.api.models.channel.ChannelRoleEnum getMissingRole() { 140 return this.missingRole; 141 } 142 143 /** 144 * builds GraphQLMissingRoleOnChannelError with checking for non-null required values 145 * @return GraphQLMissingRoleOnChannelError 146 */ 147 public GraphQLMissingRoleOnChannelError build() { 148 Objects.requireNonNull(missingRole, GraphQLMissingRoleOnChannelError.class + ": missingRole is missing"); 149 return new GraphQLMissingRoleOnChannelErrorImpl(values, channel, missingRole); 150 } 151 152 /** 153 * builds GraphQLMissingRoleOnChannelError without checking for non-null required values 154 * @return GraphQLMissingRoleOnChannelError 155 */ 156 public GraphQLMissingRoleOnChannelError buildUnchecked() { 157 return new GraphQLMissingRoleOnChannelErrorImpl(values, channel, missingRole); 158 } 159 160 /** 161 * factory method for an instance of GraphQLMissingRoleOnChannelErrorBuilder 162 * @return builder 163 */ 164 public static GraphQLMissingRoleOnChannelErrorBuilder of() { 165 return new GraphQLMissingRoleOnChannelErrorBuilder(); 166 } 167 168 /** 169 * create builder for GraphQLMissingRoleOnChannelError instance 170 * @param template instance with prefilled values for the builder 171 * @return builder 172 */ 173 public static GraphQLMissingRoleOnChannelErrorBuilder of(final GraphQLMissingRoleOnChannelError template) { 174 GraphQLMissingRoleOnChannelErrorBuilder builder = new GraphQLMissingRoleOnChannelErrorBuilder(); 175 builder.values = template.values(); 176 builder.channel = template.getChannel(); 177 builder.missingRole = template.getMissingRole(); 178 return builder; 179 } 180 181}