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