001 002package com.commercetools.api.models.message; 003 004import java.time.*; 005import java.util.*; 006import java.util.function.Function; 007 008import javax.annotation.Nullable; 009import javax.validation.constraints.NotNull; 010 011import com.commercetools.api.models.order.ShipmentState; 012import com.fasterxml.jackson.annotation.*; 013import com.fasterxml.jackson.databind.annotation.*; 014 015import io.vrap.rmf.base.client.utils.Generated; 016 017/** 018 * <p>Generated after a successful Change Shipment State update action.</p> 019 * 020 * <hr> 021 * Example to create an instance using the builder pattern 022 * <div class=code-example> 023 * <pre><code class='java'> 024 * OrderShipmentStateChangedMessage orderShipmentStateChangedMessage = OrderShipmentStateChangedMessage.builder() 025 * .id("{id}") 026 * .version(0.3) 027 * .createdAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z")) 028 * .lastModifiedAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z")) 029 * .sequenceNumber(0.3) 030 * .resource(resourceBuilder -> resourceBuilder) 031 * .resourceVersion(0.3) 032 * .shipmentState(ShipmentState.SHIPPED) 033 * .oldShipmentState(ShipmentState.SHIPPED) 034 * .build() 035 * </code></pre> 036 * </div> 037 */ 038@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 039@JsonDeserialize(as = OrderShipmentStateChangedMessageImpl.class) 040public interface OrderShipmentStateChangedMessage extends OrderMessage { 041 042 /** 043 * discriminator value for OrderShipmentStateChangedMessage 044 */ 045 String ORDER_SHIPMENT_STATE_CHANGED = "OrderShipmentStateChanged"; 046 047 /** 048 * <p>ShipmentState after the Change Shipment State update action.</p> 049 * @return shipmentState 050 */ 051 @NotNull 052 @JsonProperty("shipmentState") 053 public ShipmentState getShipmentState(); 054 055 /** 056 * <p>ShipmentState before the Change Shipment State update action.</p> 057 * @return oldShipmentState 058 */ 059 @NotNull 060 @JsonProperty("oldShipmentState") 061 public ShipmentState getOldShipmentState(); 062 063 /** 064 * <p>ShipmentState after the Change Shipment State update action.</p> 065 * @param shipmentState value to be set 066 */ 067 068 public void setShipmentState(final ShipmentState shipmentState); 069 070 /** 071 * <p>ShipmentState before the Change Shipment State update action.</p> 072 * @param oldShipmentState value to be set 073 */ 074 075 public void setOldShipmentState(final ShipmentState oldShipmentState); 076 077 /** 078 * factory method 079 * @return instance of OrderShipmentStateChangedMessage 080 */ 081 public static OrderShipmentStateChangedMessage of() { 082 return new OrderShipmentStateChangedMessageImpl(); 083 } 084 085 /** 086 * factory method to create a shallow copy OrderShipmentStateChangedMessage 087 * @param template instance to be copied 088 * @return copy instance 089 */ 090 public static OrderShipmentStateChangedMessage of(final OrderShipmentStateChangedMessage template) { 091 OrderShipmentStateChangedMessageImpl instance = new OrderShipmentStateChangedMessageImpl(); 092 instance.setId(template.getId()); 093 instance.setVersion(template.getVersion()); 094 instance.setCreatedAt(template.getCreatedAt()); 095 instance.setLastModifiedAt(template.getLastModifiedAt()); 096 instance.setLastModifiedBy(template.getLastModifiedBy()); 097 instance.setCreatedBy(template.getCreatedBy()); 098 instance.setSequenceNumber(template.getSequenceNumber()); 099 instance.setResource(template.getResource()); 100 instance.setResourceVersion(template.getResourceVersion()); 101 instance.setResourceUserProvidedIdentifiers(template.getResourceUserProvidedIdentifiers()); 102 instance.setShipmentState(template.getShipmentState()); 103 instance.setOldShipmentState(template.getOldShipmentState()); 104 return instance; 105 } 106 107 /** 108 * factory method to create a deep copy of OrderShipmentStateChangedMessage 109 * @param template instance to be copied 110 * @return copy instance 111 */ 112 @Nullable 113 public static OrderShipmentStateChangedMessage deepCopy(@Nullable final OrderShipmentStateChangedMessage template) { 114 if (template == null) { 115 return null; 116 } 117 OrderShipmentStateChangedMessageImpl instance = new OrderShipmentStateChangedMessageImpl(); 118 instance.setId(template.getId()); 119 instance.setVersion(template.getVersion()); 120 instance.setCreatedAt(template.getCreatedAt()); 121 instance.setLastModifiedAt(template.getLastModifiedAt()); 122 instance.setLastModifiedBy( 123 com.commercetools.api.models.common.LastModifiedBy.deepCopy(template.getLastModifiedBy())); 124 instance.setCreatedBy(com.commercetools.api.models.common.CreatedBy.deepCopy(template.getCreatedBy())); 125 instance.setSequenceNumber(template.getSequenceNumber()); 126 instance.setResource(com.commercetools.api.models.common.Reference.deepCopy(template.getResource())); 127 instance.setResourceVersion(template.getResourceVersion()); 128 instance.setResourceUserProvidedIdentifiers(com.commercetools.api.models.message.UserProvidedIdentifiers 129 .deepCopy(template.getResourceUserProvidedIdentifiers())); 130 instance.setShipmentState(template.getShipmentState()); 131 instance.setOldShipmentState(template.getOldShipmentState()); 132 return instance; 133 } 134 135 /** 136 * builder factory method for OrderShipmentStateChangedMessage 137 * @return builder 138 */ 139 public static OrderShipmentStateChangedMessageBuilder builder() { 140 return OrderShipmentStateChangedMessageBuilder.of(); 141 } 142 143 /** 144 * create builder for OrderShipmentStateChangedMessage instance 145 * @param template instance with prefilled values for the builder 146 * @return builder 147 */ 148 public static OrderShipmentStateChangedMessageBuilder builder(final OrderShipmentStateChangedMessage template) { 149 return OrderShipmentStateChangedMessageBuilder.of(template); 150 } 151 152 /** 153 * accessor map function 154 * @param <T> mapped type 155 * @param helper function to map the object 156 * @return mapped value 157 */ 158 default <T> T withOrderShipmentStateChangedMessage(Function<OrderShipmentStateChangedMessage, T> helper) { 159 return helper.apply(this); 160 } 161 162 /** 163 * gives a TypeReference for usage with Jackson DataBind 164 * @return TypeReference 165 */ 166 public static com.fasterxml.jackson.core.type.TypeReference<OrderShipmentStateChangedMessage> typeReference() { 167 return new com.fasterxml.jackson.core.type.TypeReference<OrderShipmentStateChangedMessage>() { 168 @Override 169 public String toString() { 170 return "TypeReference<OrderShipmentStateChangedMessage>"; 171 } 172 }; 173 } 174}