All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.sphere.sdk.orders.messages.OrderCreatedMessage Maven / Gradle / Ivy

There is a newer version: 1.0.0-M26
Show newest version
package io.sphere.sdk.orders.messages;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import io.sphere.sdk.messages.GenericMessageImpl;
import io.sphere.sdk.messages.Message;
import io.sphere.sdk.messages.MessageDerivateHint;
import io.sphere.sdk.orders.Order;

import java.time.ZonedDateTime;

@JsonDeserialize(as = OrderCreatedMessage.class)//important to override annotation in Message class
public class OrderCreatedMessage extends GenericMessageImpl {
    public static final String MESSAGE_TYPE = "OrderCreated";
    public static final MessageDerivateHint MESSAGE_HINT =
            MessageDerivateHint.ofSingleMessageType(MESSAGE_TYPE, OrderCreatedMessage.class);

    private final Order order;

    @JsonCreator
    private OrderCreatedMessage(final String id, final Long version, final ZonedDateTime createdAt, final ZonedDateTime lastModifiedAt, final JsonNode resource, final Long sequenceNumber, final Long resourceVersion, final String type, final Order order) {
        super(id, version, createdAt, lastModifiedAt, resource, sequenceNumber, resourceVersion, type, Order.class);
        this.order = order;
    }

    /**
     * Gets the order object at creation time. This output can differ from an expanded {@link Message#getResource()}.
     *
     * @return the order at creation time
     */
    public Order getOrder() {
        return order;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy