001 002package com.commercetools.api.models.review; 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 Review.</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 * ReviewReference reviewReference = ReviewReference.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 = ReviewReferenceImpl.class) 033public interface ReviewReference extends Reference, com.commercetools.api.models.Identifiable<Review> { 034 035 /** 036 * discriminator value for ReviewReference 037 */ 038 String REVIEW = "review"; 039 040 /** 041 * <p>Contains the representation of the expanded Review. Only present in responses to requests with Reference Expansion for Reviews.</p> 042 * @return obj 043 */ 044 @Valid 045 @JsonProperty("obj") 046 public Review getObj(); 047 048 /** 049 * <p>Unique identifier of the referenced Review.</p> 050 * @return id 051 */ 052 @NotNull 053 @JsonProperty("id") 054 public String getId(); 055 056 /** 057 * <p>Contains the representation of the expanded Review. Only present in responses to requests with Reference Expansion for Reviews.</p> 058 * @param obj value to be set 059 */ 060 061 public void setObj(final Review obj); 062 063 /** 064 * <p>Unique identifier of the referenced Review.</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 ReviewReference 073 */ 074 public static ReviewReference of() { 075 return new ReviewReferenceImpl(); 076 } 077 078 /** 079 * factory method to create a shallow copy ReviewReference 080 * @param template instance to be copied 081 * @return copy instance 082 */ 083 public static ReviewReference of(final ReviewReference template) { 084 ReviewReferenceImpl instance = new ReviewReferenceImpl(); 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 ReviewReference 092 * @param template instance to be copied 093 * @return copy instance 094 */ 095 @Nullable 096 public static ReviewReference deepCopy(@Nullable final ReviewReference template) { 097 if (template == null) { 098 return null; 099 } 100 ReviewReferenceImpl instance = new ReviewReferenceImpl(); 101 instance.setId(template.getId()); 102 instance.setObj(com.commercetools.api.models.review.Review.deepCopy(template.getObj())); 103 return instance; 104 } 105 106 /** 107 * builder factory method for ReviewReference 108 * @return builder 109 */ 110 public static ReviewReferenceBuilder builder() { 111 return ReviewReferenceBuilder.of(); 112 } 113 114 /** 115 * create builder for ReviewReference instance 116 * @param template instance with prefilled values for the builder 117 * @return builder 118 */ 119 public static ReviewReferenceBuilder builder(final ReviewReference template) { 120 return ReviewReferenceBuilder.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 withReviewReference(Function<ReviewReference, 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<ReviewReference> typeReference() { 138 return new com.fasterxml.jackson.core.type.TypeReference<ReviewReference>() { 139 @Override 140 public String toString() { 141 return "TypeReference<ReviewReference>"; 142 } 143 }; 144 } 145}