001 002package com.commercetools.api.models.message; 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 * ProductDeletedMessagePayloadBuilder 014 * <hr> 015 * Example to create an instance using the builder pattern 016 * <div class=code-example> 017 * <pre><code class='java'> 018 * ProductDeletedMessagePayload productDeletedMessagePayload = ProductDeletedMessagePayload.builder() 019 * .plusRemovedImageUrls(removedImageUrlsBuilder -> removedImageUrlsBuilder) 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 ProductDeletedMessagePayloadBuilder implements Builder<ProductDeletedMessagePayload> { 026 027 private java.util.List<String> removedImageUrls; 028 029 @Nullable 030 private com.commercetools.api.models.product.ProductProjection currentProjection; 031 032 /** 033 * <p>List of image URLs that were removed during the Delete Product request.</p> 034 * @param removedImageUrls value to be set 035 * @return Builder 036 */ 037 038 public ProductDeletedMessagePayloadBuilder removedImageUrls(final String... removedImageUrls) { 039 this.removedImageUrls = new ArrayList<>(Arrays.asList(removedImageUrls)); 040 return this; 041 } 042 043 /** 044 * <p>List of image URLs that were removed during the Delete Product request.</p> 045 * @param removedImageUrls value to be set 046 * @return Builder 047 */ 048 049 public ProductDeletedMessagePayloadBuilder removedImageUrls(final java.util.List<String> removedImageUrls) { 050 this.removedImageUrls = removedImageUrls; 051 return this; 052 } 053 054 /** 055 * <p>List of image URLs that were removed during the Delete Product request.</p> 056 * @param removedImageUrls value to be set 057 * @return Builder 058 */ 059 060 public ProductDeletedMessagePayloadBuilder plusRemovedImageUrls(final String... removedImageUrls) { 061 if (this.removedImageUrls == null) { 062 this.removedImageUrls = new ArrayList<>(); 063 } 064 this.removedImageUrls.addAll(Arrays.asList(removedImageUrls)); 065 return this; 066 } 067 068 /** 069 * <p>Current Product Projection of the deleted Product.</p> 070 * @param builder function to build the currentProjection value 071 * @return Builder 072 */ 073 074 public ProductDeletedMessagePayloadBuilder currentProjection( 075 Function<com.commercetools.api.models.product.ProductProjectionBuilder, com.commercetools.api.models.product.ProductProjectionBuilder> builder) { 076 this.currentProjection = builder.apply(com.commercetools.api.models.product.ProductProjectionBuilder.of()) 077 .build(); 078 return this; 079 } 080 081 /** 082 * <p>Current Product Projection of the deleted Product.</p> 083 * @param builder function to build the currentProjection value 084 * @return Builder 085 */ 086 087 public ProductDeletedMessagePayloadBuilder withCurrentProjection( 088 Function<com.commercetools.api.models.product.ProductProjectionBuilder, com.commercetools.api.models.product.ProductProjection> builder) { 089 this.currentProjection = builder.apply(com.commercetools.api.models.product.ProductProjectionBuilder.of()); 090 return this; 091 } 092 093 /** 094 * <p>Current Product Projection of the deleted Product.</p> 095 * @param currentProjection value to be set 096 * @return Builder 097 */ 098 099 public ProductDeletedMessagePayloadBuilder currentProjection( 100 @Nullable final com.commercetools.api.models.product.ProductProjection currentProjection) { 101 this.currentProjection = currentProjection; 102 return this; 103 } 104 105 /** 106 * <p>List of image URLs that were removed during the Delete Product request.</p> 107 * @return removedImageUrls 108 */ 109 110 public java.util.List<String> getRemovedImageUrls() { 111 return this.removedImageUrls; 112 } 113 114 /** 115 * <p>Current Product Projection of the deleted Product.</p> 116 * @return currentProjection 117 */ 118 119 @Nullable 120 public com.commercetools.api.models.product.ProductProjection getCurrentProjection() { 121 return this.currentProjection; 122 } 123 124 /** 125 * builds ProductDeletedMessagePayload with checking for non-null required values 126 * @return ProductDeletedMessagePayload 127 */ 128 public ProductDeletedMessagePayload build() { 129 Objects.requireNonNull(removedImageUrls, ProductDeletedMessagePayload.class + ": removedImageUrls is missing"); 130 return new ProductDeletedMessagePayloadImpl(removedImageUrls, currentProjection); 131 } 132 133 /** 134 * builds ProductDeletedMessagePayload without checking for non-null required values 135 * @return ProductDeletedMessagePayload 136 */ 137 public ProductDeletedMessagePayload buildUnchecked() { 138 return new ProductDeletedMessagePayloadImpl(removedImageUrls, currentProjection); 139 } 140 141 /** 142 * factory method for an instance of ProductDeletedMessagePayloadBuilder 143 * @return builder 144 */ 145 public static ProductDeletedMessagePayloadBuilder of() { 146 return new ProductDeletedMessagePayloadBuilder(); 147 } 148 149 /** 150 * create builder for ProductDeletedMessagePayload instance 151 * @param template instance with prefilled values for the builder 152 * @return builder 153 */ 154 public static ProductDeletedMessagePayloadBuilder of(final ProductDeletedMessagePayload template) { 155 ProductDeletedMessagePayloadBuilder builder = new ProductDeletedMessagePayloadBuilder(); 156 builder.removedImageUrls = template.getRemovedImageUrls(); 157 builder.currentProjection = template.getCurrentProjection(); 158 return builder; 159 } 160 161}