001 002package com.commercetools.history.models.common; 003 004import java.time.*; 005import java.util.*; 006import java.util.function.Function; 007 008import javax.annotation.Nullable; 009import javax.validation.constraints.NotNull; 010 011import com.fasterxml.jackson.annotation.*; 012import com.fasterxml.jackson.databind.annotation.*; 013 014import io.vrap.rmf.base.client.utils.Generated; 015 016/** 017 * ProductVariantSelection 018 * 019 * <hr> 020 * Example to create an instance using the builder pattern 021 * <div class=code-example> 022 * <pre><code class='java'> 023 * ProductVariantSelection productVariantSelection = ProductVariantSelection.builder() 024 * .type(ProductVariantSelectionTypeEnum.INCLUSION) 025 * .plusSkus(skusBuilder -> skusBuilder) 026 * .build() 027 * </code></pre> 028 * </div> 029 */ 030@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 031@JsonDeserialize(as = ProductVariantSelectionImpl.class) 032public interface ProductVariantSelection { 033 034 /** 035 * 036 * @return type 037 */ 038 @NotNull 039 @JsonProperty("type") 040 public ProductVariantSelectionTypeEnum getType(); 041 042 /** 043 * 044 * @return skus 045 */ 046 @NotNull 047 @JsonProperty("skus") 048 public List<String> getSkus(); 049 050 /** 051 * set type 052 * @param type value to be set 053 */ 054 055 public void setType(final ProductVariantSelectionTypeEnum type); 056 057 /** 058 * set skus 059 * @param skus values to be set 060 */ 061 062 @JsonIgnore 063 public void setSkus(final String... skus); 064 065 /** 066 * set skus 067 * @param skus values to be set 068 */ 069 070 public void setSkus(final List<String> skus); 071 072 /** 073 * factory method 074 * @return instance of ProductVariantSelection 075 */ 076 public static ProductVariantSelection of() { 077 return new ProductVariantSelectionImpl(); 078 } 079 080 /** 081 * factory method to create a shallow copy ProductVariantSelection 082 * @param template instance to be copied 083 * @return copy instance 084 */ 085 public static ProductVariantSelection of(final ProductVariantSelection template) { 086 ProductVariantSelectionImpl instance = new ProductVariantSelectionImpl(); 087 instance.setType(template.getType()); 088 instance.setSkus(template.getSkus()); 089 return instance; 090 } 091 092 /** 093 * factory method to create a deep copy of ProductVariantSelection 094 * @param template instance to be copied 095 * @return copy instance 096 */ 097 @Nullable 098 public static ProductVariantSelection deepCopy(@Nullable final ProductVariantSelection template) { 099 if (template == null) { 100 return null; 101 } 102 ProductVariantSelectionImpl instance = new ProductVariantSelectionImpl(); 103 instance.setType(template.getType()); 104 instance.setSkus(Optional.ofNullable(template.getSkus()).map(ArrayList::new).orElse(null)); 105 return instance; 106 } 107 108 /** 109 * builder factory method for ProductVariantSelection 110 * @return builder 111 */ 112 public static ProductVariantSelectionBuilder builder() { 113 return ProductVariantSelectionBuilder.of(); 114 } 115 116 /** 117 * create builder for ProductVariantSelection instance 118 * @param template instance with prefilled values for the builder 119 * @return builder 120 */ 121 public static ProductVariantSelectionBuilder builder(final ProductVariantSelection template) { 122 return ProductVariantSelectionBuilder.of(template); 123 } 124 125 /** 126 * accessor map function 127 * @param <T> mapped type 128 * @param helper function to map the object 129 * @return mapped value 130 */ 131 default <T> T withProductVariantSelection(Function<ProductVariantSelection, T> helper) { 132 return helper.apply(this); 133 } 134 135 /** 136 * gives a TypeReference for usage with Jackson DataBind 137 * @return TypeReference 138 */ 139 public static com.fasterxml.jackson.core.type.TypeReference<ProductVariantSelection> typeReference() { 140 return new com.fasterxml.jackson.core.type.TypeReference<ProductVariantSelection>() { 141 @Override 142 public String toString() { 143 return "TypeReference<ProductVariantSelection>"; 144 } 145 }; 146 } 147}