001 002package com.commercetools.api.models.cart; 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.fasterxml.jackson.annotation.*; 014import com.fasterxml.jackson.databind.annotation.*; 015 016import io.vrap.rmf.base.client.utils.Generated; 017 018/** 019 * CartApplyDeltaToCustomLineItemShippingDetailsTargetsAction 020 * 021 * <hr> 022 * Example to create an instance using the builder pattern 023 * <div class=code-example> 024 * <pre><code class='java'> 025 * CartApplyDeltaToCustomLineItemShippingDetailsTargetsAction cartApplyDeltaToCustomLineItemShippingDetailsTargetsAction = CartApplyDeltaToCustomLineItemShippingDetailsTargetsAction.builder() 026 * .customLineItemId("{customLineItemId}") 027 * .plusTargetsDelta(targetsDeltaBuilder -> targetsDeltaBuilder) 028 * .build() 029 * </code></pre> 030 * </div> 031 */ 032@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 033@JsonDeserialize(as = CartApplyDeltaToCustomLineItemShippingDetailsTargetsActionImpl.class) 034public interface CartApplyDeltaToCustomLineItemShippingDetailsTargetsAction extends CartUpdateAction { 035 036 /** 037 * discriminator value for CartApplyDeltaToCustomLineItemShippingDetailsTargetsAction 038 */ 039 String APPLY_DELTA_TO_CUSTOM_LINE_ITEM_SHIPPING_DETAILS_TARGETS = "applyDeltaToCustomLineItemShippingDetailsTargets"; 040 041 /** 042 * <p><code>id</code> of the CustomLineItem to update.</p> 043 * @return customLineItemId 044 */ 045 @NotNull 046 @JsonProperty("customLineItemId") 047 public String getCustomLineItemId(); 048 049 /** 050 * <p>Using positive or negative quantities increases or decreases the number of items shipped to an address.</p> 051 * @return targetsDelta 052 */ 053 @NotNull 054 @Valid 055 @JsonProperty("targetsDelta") 056 public List<ItemShippingTarget> getTargetsDelta(); 057 058 /** 059 * <p><code>id</code> of the CustomLineItem to update.</p> 060 * @param customLineItemId value to be set 061 */ 062 063 public void setCustomLineItemId(final String customLineItemId); 064 065 /** 066 * <p>Using positive or negative quantities increases or decreases the number of items shipped to an address.</p> 067 * @param targetsDelta values to be set 068 */ 069 070 @JsonIgnore 071 public void setTargetsDelta(final ItemShippingTarget... targetsDelta); 072 073 /** 074 * <p>Using positive or negative quantities increases or decreases the number of items shipped to an address.</p> 075 * @param targetsDelta values to be set 076 */ 077 078 public void setTargetsDelta(final List<ItemShippingTarget> targetsDelta); 079 080 /** 081 * factory method 082 * @return instance of CartApplyDeltaToCustomLineItemShippingDetailsTargetsAction 083 */ 084 public static CartApplyDeltaToCustomLineItemShippingDetailsTargetsAction of() { 085 return new CartApplyDeltaToCustomLineItemShippingDetailsTargetsActionImpl(); 086 } 087 088 /** 089 * factory method to create a shallow copy CartApplyDeltaToCustomLineItemShippingDetailsTargetsAction 090 * @param template instance to be copied 091 * @return copy instance 092 */ 093 public static CartApplyDeltaToCustomLineItemShippingDetailsTargetsAction of( 094 final CartApplyDeltaToCustomLineItemShippingDetailsTargetsAction template) { 095 CartApplyDeltaToCustomLineItemShippingDetailsTargetsActionImpl instance = new CartApplyDeltaToCustomLineItemShippingDetailsTargetsActionImpl(); 096 instance.setCustomLineItemId(template.getCustomLineItemId()); 097 instance.setTargetsDelta(template.getTargetsDelta()); 098 return instance; 099 } 100 101 /** 102 * factory method to create a deep copy of CartApplyDeltaToCustomLineItemShippingDetailsTargetsAction 103 * @param template instance to be copied 104 * @return copy instance 105 */ 106 @Nullable 107 public static CartApplyDeltaToCustomLineItemShippingDetailsTargetsAction deepCopy( 108 @Nullable final CartApplyDeltaToCustomLineItemShippingDetailsTargetsAction template) { 109 if (template == null) { 110 return null; 111 } 112 CartApplyDeltaToCustomLineItemShippingDetailsTargetsActionImpl instance = new CartApplyDeltaToCustomLineItemShippingDetailsTargetsActionImpl(); 113 instance.setCustomLineItemId(template.getCustomLineItemId()); 114 instance.setTargetsDelta(Optional.ofNullable(template.getTargetsDelta()) 115 .map(t -> t.stream() 116 .map(com.commercetools.api.models.cart.ItemShippingTarget::deepCopy) 117 .collect(Collectors.toList())) 118 .orElse(null)); 119 return instance; 120 } 121 122 /** 123 * builder factory method for CartApplyDeltaToCustomLineItemShippingDetailsTargetsAction 124 * @return builder 125 */ 126 public static CartApplyDeltaToCustomLineItemShippingDetailsTargetsActionBuilder builder() { 127 return CartApplyDeltaToCustomLineItemShippingDetailsTargetsActionBuilder.of(); 128 } 129 130 /** 131 * create builder for CartApplyDeltaToCustomLineItemShippingDetailsTargetsAction instance 132 * @param template instance with prefilled values for the builder 133 * @return builder 134 */ 135 public static CartApplyDeltaToCustomLineItemShippingDetailsTargetsActionBuilder builder( 136 final CartApplyDeltaToCustomLineItemShippingDetailsTargetsAction template) { 137 return CartApplyDeltaToCustomLineItemShippingDetailsTargetsActionBuilder.of(template); 138 } 139 140 /** 141 * accessor map function 142 * @param <T> mapped type 143 * @param helper function to map the object 144 * @return mapped value 145 */ 146 default <T> T withCartApplyDeltaToCustomLineItemShippingDetailsTargetsAction( 147 Function<CartApplyDeltaToCustomLineItemShippingDetailsTargetsAction, T> helper) { 148 return helper.apply(this); 149 } 150 151 /** 152 * gives a TypeReference for usage with Jackson DataBind 153 * @return TypeReference 154 */ 155 public static com.fasterxml.jackson.core.type.TypeReference<CartApplyDeltaToCustomLineItemShippingDetailsTargetsAction> typeReference() { 156 return new com.fasterxml.jackson.core.type.TypeReference<CartApplyDeltaToCustomLineItemShippingDetailsTargetsAction>() { 157 @Override 158 public String toString() { 159 return "TypeReference<CartApplyDeltaToCustomLineItemShippingDetailsTargetsAction>"; 160 } 161 }; 162 } 163}