001 002package com.commercetools.ml.models.similar_products; 003 004import java.time.*; 005import java.util.*; 006import java.util.function.Function; 007 008import javax.annotation.Nullable; 009import javax.validation.Valid; 010 011import com.commercetools.ml.models.common.LocalizedString; 012import com.commercetools.ml.models.common.Money; 013import com.fasterxml.jackson.annotation.*; 014import com.fasterxml.jackson.databind.annotation.*; 015 016import io.vrap.rmf.base.client.utils.Generated; 017 018/** 019 * SimilarProductMeta 020 * 021 * <hr> 022 * Example to create an instance using the builder pattern 023 * <div class=code-example> 024 * <pre><code class='java'> 025 * SimilarProductMeta similarProductMeta = SimilarProductMeta.builder() 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 = SimilarProductMetaImpl.class) 032public interface SimilarProductMeta { 033 034 /** 035 * <p>Localized product name used for similarity estimation.</p> 036 * @return name 037 */ 038 @Valid 039 @JsonProperty("name") 040 public LocalizedString getName(); 041 042 /** 043 * <p>Localized product description used for similarity estimation.</p> 044 * @return description 045 */ 046 @Valid 047 @JsonProperty("description") 048 public LocalizedString getDescription(); 049 050 /** 051 * <p>The product price in cents using the currency defined in SimilarProductSearchRequest If multiple prices exist, the median value is taken as a representative amount.</p> 052 * @return price 053 */ 054 @Valid 055 @JsonProperty("price") 056 public Money getPrice(); 057 058 /** 059 * <p>Total number of variants associated with the product.</p> 060 * @return variantCount 061 */ 062 063 @JsonProperty("variantCount") 064 public Long getVariantCount(); 065 066 /** 067 * <p>Localized product name used for similarity estimation.</p> 068 * @param name value to be set 069 */ 070 071 public void setName(final LocalizedString name); 072 073 /** 074 * <p>Localized product description used for similarity estimation.</p> 075 * @param description value to be set 076 */ 077 078 public void setDescription(final LocalizedString description); 079 080 /** 081 * <p>The product price in cents using the currency defined in SimilarProductSearchRequest If multiple prices exist, the median value is taken as a representative amount.</p> 082 * @param price value to be set 083 */ 084 085 public void setPrice(final Money price); 086 087 /** 088 * <p>Total number of variants associated with the product.</p> 089 * @param variantCount value to be set 090 */ 091 092 public void setVariantCount(final Long variantCount); 093 094 /** 095 * factory method 096 * @return instance of SimilarProductMeta 097 */ 098 public static SimilarProductMeta of() { 099 return new SimilarProductMetaImpl(); 100 } 101 102 /** 103 * factory method to create a shallow copy SimilarProductMeta 104 * @param template instance to be copied 105 * @return copy instance 106 */ 107 public static SimilarProductMeta of(final SimilarProductMeta template) { 108 SimilarProductMetaImpl instance = new SimilarProductMetaImpl(); 109 instance.setName(template.getName()); 110 instance.setDescription(template.getDescription()); 111 instance.setPrice(template.getPrice()); 112 instance.setVariantCount(template.getVariantCount()); 113 return instance; 114 } 115 116 /** 117 * factory method to create a deep copy of SimilarProductMeta 118 * @param template instance to be copied 119 * @return copy instance 120 */ 121 @Nullable 122 public static SimilarProductMeta deepCopy(@Nullable final SimilarProductMeta template) { 123 if (template == null) { 124 return null; 125 } 126 SimilarProductMetaImpl instance = new SimilarProductMetaImpl(); 127 instance.setName(com.commercetools.ml.models.common.LocalizedString.deepCopy(template.getName())); 128 instance.setDescription(com.commercetools.ml.models.common.LocalizedString.deepCopy(template.getDescription())); 129 instance.setPrice(com.commercetools.ml.models.common.Money.deepCopy(template.getPrice())); 130 instance.setVariantCount(template.getVariantCount()); 131 return instance; 132 } 133 134 /** 135 * builder factory method for SimilarProductMeta 136 * @return builder 137 */ 138 public static SimilarProductMetaBuilder builder() { 139 return SimilarProductMetaBuilder.of(); 140 } 141 142 /** 143 * create builder for SimilarProductMeta instance 144 * @param template instance with prefilled values for the builder 145 * @return builder 146 */ 147 public static SimilarProductMetaBuilder builder(final SimilarProductMeta template) { 148 return SimilarProductMetaBuilder.of(template); 149 } 150 151 /** 152 * accessor map function 153 * @param <T> mapped type 154 * @param helper function to map the object 155 * @return mapped value 156 */ 157 default <T> T withSimilarProductMeta(Function<SimilarProductMeta, T> helper) { 158 return helper.apply(this); 159 } 160 161 /** 162 * gives a TypeReference for usage with Jackson DataBind 163 * @return TypeReference 164 */ 165 public static com.fasterxml.jackson.core.type.TypeReference<SimilarProductMeta> typeReference() { 166 return new com.fasterxml.jackson.core.type.TypeReference<SimilarProductMeta>() { 167 @Override 168 public String toString() { 169 return "TypeReference<SimilarProductMeta>"; 170 } 171 }; 172 } 173}