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.Valid; 010import javax.validation.constraints.NotNull; 011 012import com.fasterxml.jackson.annotation.*; 013import com.fasterxml.jackson.databind.annotation.*; 014 015import io.vrap.rmf.base.client.utils.Generated; 016 017/** 018 * Price 019 * 020 * <hr> 021 * Example to create an instance using the builder pattern 022 * <div class=code-example> 023 * <pre><code class='java'> 024 * Price price = Price.builder() 025 * .id("{id}") 026 * .value(valueBuilder -> valueBuilder) 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 = PriceImpl.class) 033public interface Price { 034 035 /** 036 * 037 * @return id 038 */ 039 @NotNull 040 @JsonProperty("id") 041 public String getId(); 042 043 /** 044 * 045 * @return value 046 */ 047 @NotNull 048 @Valid 049 @JsonProperty("value") 050 public Money getValue(); 051 052 /** 053 * set id 054 * @param id value to be set 055 */ 056 057 public void setId(final String id); 058 059 /** 060 * set value 061 * @param value value to be set 062 */ 063 064 public void setValue(final Money value); 065 066 /** 067 * factory method 068 * @return instance of Price 069 */ 070 public static Price of() { 071 return new PriceImpl(); 072 } 073 074 /** 075 * factory method to create a shallow copy Price 076 * @param template instance to be copied 077 * @return copy instance 078 */ 079 public static Price of(final Price template) { 080 PriceImpl instance = new PriceImpl(); 081 instance.setId(template.getId()); 082 instance.setValue(template.getValue()); 083 return instance; 084 } 085 086 /** 087 * factory method to create a deep copy of Price 088 * @param template instance to be copied 089 * @return copy instance 090 */ 091 @Nullable 092 public static Price deepCopy(@Nullable final Price template) { 093 if (template == null) { 094 return null; 095 } 096 PriceImpl instance = new PriceImpl(); 097 instance.setId(template.getId()); 098 instance.setValue(com.commercetools.history.models.common.Money.deepCopy(template.getValue())); 099 return instance; 100 } 101 102 /** 103 * builder factory method for Price 104 * @return builder 105 */ 106 public static PriceBuilder builder() { 107 return PriceBuilder.of(); 108 } 109 110 /** 111 * create builder for Price instance 112 * @param template instance with prefilled values for the builder 113 * @return builder 114 */ 115 public static PriceBuilder builder(final Price template) { 116 return PriceBuilder.of(template); 117 } 118 119 /** 120 * accessor map function 121 * @param <T> mapped type 122 * @param helper function to map the object 123 * @return mapped value 124 */ 125 default <T> T withPrice(Function<Price, T> helper) { 126 return helper.apply(this); 127 } 128 129 /** 130 * gives a TypeReference for usage with Jackson DataBind 131 * @return TypeReference 132 */ 133 public static com.fasterxml.jackson.core.type.TypeReference<Price> typeReference() { 134 return new com.fasterxml.jackson.core.type.TypeReference<Price>() { 135 @Override 136 public String toString() { 137 return "TypeReference<Price>"; 138 } 139 }; 140 } 141}