001 002package com.commercetools.importapi.models.orders; 003 004import java.time.*; 005import java.util.*; 006import java.util.function.Function; 007import java.util.stream.Collectors; 008 009import javax.annotation.Nullable; 010import javax.validation.Valid; 011import javax.validation.constraints.NotNull; 012 013import com.commercetools.importapi.models.common.Money; 014import com.fasterxml.jackson.annotation.*; 015import com.fasterxml.jackson.databind.annotation.*; 016 017import io.vrap.rmf.base.client.utils.Generated; 018 019/** 020 * CartClassificationTier 021 * 022 * <hr> 023 * Example to create an instance using the builder pattern 024 * <div class=code-example> 025 * <pre><code class='java'> 026 * CartClassificationTier cartClassificationTier = CartClassificationTier.builder() 027 * .value("{value}") 028 * .price(priceBuilder -> priceBuilder) 029 * .plusTiers(tiersBuilder -> tiersBuilder) 030 * .build() 031 * </code></pre> 032 * </div> 033 */ 034@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 035@JsonDeserialize(as = CartClassificationTierImpl.class) 036public interface CartClassificationTier extends ShippingRatePriceTier { 037 038 /** 039 * discriminator value for CartClassificationTier 040 */ 041 String CART_CLASSIFICATION = "CartClassification"; 042 043 /** 044 * 045 * @return value 046 */ 047 @NotNull 048 @JsonProperty("value") 049 public String getValue(); 050 051 /** 052 * 053 * @return price 054 */ 055 @NotNull 056 @Valid 057 @JsonProperty("price") 058 public Money getPrice(); 059 060 /** 061 * 062 * @return tiers 063 */ 064 @NotNull 065 @Valid 066 @JsonProperty("tiers") 067 public List<ShippingRatePriceTier> getTiers(); 068 069 /** 070 * 071 * @return isMatching 072 */ 073 074 @JsonProperty("isMatching") 075 public Boolean getIsMatching(); 076 077 /** 078 * set value 079 * @param value value to be set 080 */ 081 082 public void setValue(final String value); 083 084 /** 085 * set price 086 * @param price value to be set 087 */ 088 089 public void setPrice(final Money price); 090 091 /** 092 * set tiers 093 * @param tiers values to be set 094 */ 095 096 @JsonIgnore 097 public void setTiers(final ShippingRatePriceTier... tiers); 098 099 /** 100 * set tiers 101 * @param tiers values to be set 102 */ 103 104 public void setTiers(final List<ShippingRatePriceTier> tiers); 105 106 /** 107 * set isMatching 108 * @param isMatching value to be set 109 */ 110 111 public void setIsMatching(final Boolean isMatching); 112 113 /** 114 * factory method 115 * @return instance of CartClassificationTier 116 */ 117 public static CartClassificationTier of() { 118 return new CartClassificationTierImpl(); 119 } 120 121 /** 122 * factory method to create a shallow copy CartClassificationTier 123 * @param template instance to be copied 124 * @return copy instance 125 */ 126 public static CartClassificationTier of(final CartClassificationTier template) { 127 CartClassificationTierImpl instance = new CartClassificationTierImpl(); 128 instance.setValue(template.getValue()); 129 instance.setPrice(template.getPrice()); 130 instance.setTiers(template.getTiers()); 131 instance.setIsMatching(template.getIsMatching()); 132 return instance; 133 } 134 135 /** 136 * factory method to create a deep copy of CartClassificationTier 137 * @param template instance to be copied 138 * @return copy instance 139 */ 140 @Nullable 141 public static CartClassificationTier deepCopy(@Nullable final CartClassificationTier template) { 142 if (template == null) { 143 return null; 144 } 145 CartClassificationTierImpl instance = new CartClassificationTierImpl(); 146 instance.setValue(template.getValue()); 147 instance.setPrice(com.commercetools.importapi.models.common.Money.deepCopy(template.getPrice())); 148 instance.setTiers(Optional.ofNullable(template.getTiers()) 149 .map(t -> t.stream() 150 .map(com.commercetools.importapi.models.orders.ShippingRatePriceTier::deepCopy) 151 .collect(Collectors.toList())) 152 .orElse(null)); 153 instance.setIsMatching(template.getIsMatching()); 154 return instance; 155 } 156 157 /** 158 * builder factory method for CartClassificationTier 159 * @return builder 160 */ 161 public static CartClassificationTierBuilder builder() { 162 return CartClassificationTierBuilder.of(); 163 } 164 165 /** 166 * create builder for CartClassificationTier instance 167 * @param template instance with prefilled values for the builder 168 * @return builder 169 */ 170 public static CartClassificationTierBuilder builder(final CartClassificationTier template) { 171 return CartClassificationTierBuilder.of(template); 172 } 173 174 /** 175 * accessor map function 176 * @param <T> mapped type 177 * @param helper function to map the object 178 * @return mapped value 179 */ 180 default <T> T withCartClassificationTier(Function<CartClassificationTier, T> helper) { 181 return helper.apply(this); 182 } 183 184 /** 185 * gives a TypeReference for usage with Jackson DataBind 186 * @return TypeReference 187 */ 188 public static com.fasterxml.jackson.core.type.TypeReference<CartClassificationTier> typeReference() { 189 return new com.fasterxml.jackson.core.type.TypeReference<CartClassificationTier>() { 190 @Override 191 public String toString() { 192 return "TypeReference<CartClassificationTier>"; 193 } 194 }; 195 } 196}