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

io.sphere.sdk.orders.DeliveryItem Maven / Gradle / Ivy

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

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.sphere.sdk.carts.LineItemLike;
import io.sphere.sdk.models.Base;

public class DeliveryItem extends Base {
    private final String id;
    private final Long quantity;

    @JsonCreator
    private DeliveryItem(final String id, final Long quantity) {
        this.id = id;
        this.quantity = quantity;
    }

    public String getId() {
        return id;
    }

    public Long getQuantity() {
        return quantity;
    }

    public static DeliveryItem of(final String id, final long quantity) {
        return of(id, Long.valueOf(quantity));
    }

    public static DeliveryItem of(final String id, final Long quantity) {
        return new DeliveryItem(id, quantity);
    }

    @JsonIgnore
    public static DeliveryItem of(final LineItemLike lineItem, final Long quantity) {
        return of(lineItem.getId(), quantity);
    }

    @JsonIgnore
    public static DeliveryItem of(final LineItemLike lineItem) {
        return of(lineItem, lineItem.getQuantity());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy