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