001 002package com.commercetools.history.models.change_value; 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.history.models.common.Address; 014import com.commercetools.history.models.common.DeliveryItem; 015import com.commercetools.history.models.common.Parcel; 016import com.fasterxml.jackson.annotation.*; 017import com.fasterxml.jackson.databind.annotation.*; 018 019import io.vrap.rmf.base.client.utils.Generated; 020 021/** 022 * DeliveryChangeValue 023 * 024 * <hr> 025 * Example to create an instance using the builder pattern 026 * <div class=code-example> 027 * <pre><code class='java'> 028 * DeliveryChangeValue deliveryChangeValue = DeliveryChangeValue.builder() 029 * .plusItems(itemsBuilder -> itemsBuilder) 030 * .address(addressBuilder -> addressBuilder) 031 * .plusParcels(parcelsBuilder -> parcelsBuilder) 032 * .build() 033 * </code></pre> 034 * </div> 035 */ 036@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 037@JsonDeserialize(as = DeliveryChangeValueImpl.class) 038public interface DeliveryChangeValue { 039 040 /** 041 * <p>Line Items or Custom Line Items shipped in the Delivery.</p> 042 * @return items 043 */ 044 @NotNull 045 @Valid 046 @JsonProperty("items") 047 public List<DeliveryItem> getItems(); 048 049 /** 050 * <p>Address to which the parcels are delivered.</p> 051 * @return address 052 */ 053 @NotNull 054 @Valid 055 @JsonProperty("address") 056 public Address getAddress(); 057 058 /** 059 * <p>Parcels included in the Delivery.</p> 060 * @return parcels 061 */ 062 @NotNull 063 @Valid 064 @JsonProperty("parcels") 065 public List<Parcel> getParcels(); 066 067 /** 068 * <p>Line Items or Custom Line Items shipped in the Delivery.</p> 069 * @param items values to be set 070 */ 071 072 @JsonIgnore 073 public void setItems(final DeliveryItem... items); 074 075 /** 076 * <p>Line Items or Custom Line Items shipped in the Delivery.</p> 077 * @param items values to be set 078 */ 079 080 public void setItems(final List<DeliveryItem> items); 081 082 /** 083 * <p>Address to which the parcels are delivered.</p> 084 * @param address value to be set 085 */ 086 087 public void setAddress(final Address address); 088 089 /** 090 * <p>Parcels included in the Delivery.</p> 091 * @param parcels values to be set 092 */ 093 094 @JsonIgnore 095 public void setParcels(final Parcel... parcels); 096 097 /** 098 * <p>Parcels included in the Delivery.</p> 099 * @param parcels values to be set 100 */ 101 102 public void setParcels(final List<Parcel> parcels); 103 104 /** 105 * factory method 106 * @return instance of DeliveryChangeValue 107 */ 108 public static DeliveryChangeValue of() { 109 return new DeliveryChangeValueImpl(); 110 } 111 112 /** 113 * factory method to create a shallow copy DeliveryChangeValue 114 * @param template instance to be copied 115 * @return copy instance 116 */ 117 public static DeliveryChangeValue of(final DeliveryChangeValue template) { 118 DeliveryChangeValueImpl instance = new DeliveryChangeValueImpl(); 119 instance.setItems(template.getItems()); 120 instance.setAddress(template.getAddress()); 121 instance.setParcels(template.getParcels()); 122 return instance; 123 } 124 125 /** 126 * factory method to create a deep copy of DeliveryChangeValue 127 * @param template instance to be copied 128 * @return copy instance 129 */ 130 @Nullable 131 public static DeliveryChangeValue deepCopy(@Nullable final DeliveryChangeValue template) { 132 if (template == null) { 133 return null; 134 } 135 DeliveryChangeValueImpl instance = new DeliveryChangeValueImpl(); 136 instance.setItems(Optional.ofNullable(template.getItems()) 137 .map(t -> t.stream() 138 .map(com.commercetools.history.models.common.DeliveryItem::deepCopy) 139 .collect(Collectors.toList())) 140 .orElse(null)); 141 instance.setAddress(com.commercetools.history.models.common.Address.deepCopy(template.getAddress())); 142 instance.setParcels(Optional.ofNullable(template.getParcels()) 143 .map(t -> t.stream() 144 .map(com.commercetools.history.models.common.Parcel::deepCopy) 145 .collect(Collectors.toList())) 146 .orElse(null)); 147 return instance; 148 } 149 150 /** 151 * builder factory method for DeliveryChangeValue 152 * @return builder 153 */ 154 public static DeliveryChangeValueBuilder builder() { 155 return DeliveryChangeValueBuilder.of(); 156 } 157 158 /** 159 * create builder for DeliveryChangeValue instance 160 * @param template instance with prefilled values for the builder 161 * @return builder 162 */ 163 public static DeliveryChangeValueBuilder builder(final DeliveryChangeValue template) { 164 return DeliveryChangeValueBuilder.of(template); 165 } 166 167 /** 168 * accessor map function 169 * @param <T> mapped type 170 * @param helper function to map the object 171 * @return mapped value 172 */ 173 default <T> T withDeliveryChangeValue(Function<DeliveryChangeValue, T> helper) { 174 return helper.apply(this); 175 } 176 177 /** 178 * gives a TypeReference for usage with Jackson DataBind 179 * @return TypeReference 180 */ 181 public static com.fasterxml.jackson.core.type.TypeReference<DeliveryChangeValue> typeReference() { 182 return new com.fasterxml.jackson.core.type.TypeReference<DeliveryChangeValue>() { 183 @Override 184 public String toString() { 185 return "TypeReference<DeliveryChangeValue>"; 186 } 187 }; 188 } 189}