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