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

com.flexport.api.resources.bookinglineitem.requests.CreateBookingLineItem Maven / Gradle / Ivy

The newest version!
package com.flexport.api.resources.bookinglineitem.requests;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.Objects;

@JsonDeserialize(builder = CreateBookingLineItem.Builder.class)
public final class CreateBookingLineItem {
    private final int purchaseOrderLineItemId;

    private final int bookingId;

    private final int units;

    private int _cachedHashCode;

    CreateBookingLineItem(int purchaseOrderLineItemId, int bookingId, int units) {
        this.purchaseOrderLineItemId = purchaseOrderLineItemId;
        this.bookingId = bookingId;
        this.units = units;
    }

    /**
     * @return Always required. The identifier of the PO line item to book
     */
    @JsonProperty("purchase_order_line_item_id")
    public int getPurchaseOrderLineItemId() {
        return purchaseOrderLineItemId;
    }

    /**
     * @return Always required. The identifier of the booking to add the PO line item to
     */
    @JsonProperty("booking_id")
    public int getBookingId() {
        return bookingId;
    }

    /**
     * @return Always required. Number of units to book
     */
    @JsonProperty("units")
    public int getUnits() {
        return units;
    }

    @Override
    public boolean equals(Object other) {
        if (this == other) return true;
        return other instanceof CreateBookingLineItem && equalTo((CreateBookingLineItem) other);
    }

    private boolean equalTo(CreateBookingLineItem other) {
        return purchaseOrderLineItemId == other.purchaseOrderLineItemId
                && bookingId == other.bookingId
                && units == other.units;
    }

    @Override
    public int hashCode() {
        if (_cachedHashCode == 0) {
            _cachedHashCode = Objects.hash(this.purchaseOrderLineItemId, this.bookingId, this.units);
        }
        return _cachedHashCode;
    }

    @Override
    public String toString() {
        return "CreateBookingLineItem{" + "purchaseOrderLineItemId: " + purchaseOrderLineItemId + ", bookingId: "
                + bookingId + ", units: " + units + "}";
    }

    public static PurchaseOrderLineItemIdStage builder() {
        return new Builder();
    }

    public interface PurchaseOrderLineItemIdStage {
        BookingIdStage purchaseOrderLineItemId(int purchaseOrderLineItemId);

        Builder from(CreateBookingLineItem other);
    }

    public interface BookingIdStage {
        UnitsStage bookingId(int bookingId);
    }

    public interface UnitsStage {
        _FinalStage units(int units);
    }

    public interface _FinalStage {
        CreateBookingLineItem build();
    }

    @JsonIgnoreProperties(ignoreUnknown = true)
    public static final class Builder implements PurchaseOrderLineItemIdStage, BookingIdStage, UnitsStage, _FinalStage {
        private int purchaseOrderLineItemId;

        private int bookingId;

        private int units;

        private Builder() {}

        @Override
        public Builder from(CreateBookingLineItem other) {
            purchaseOrderLineItemId(other.getPurchaseOrderLineItemId());
            bookingId(other.getBookingId());
            units(other.getUnits());
            return this;
        }

        /**
         * 

Always required. The identifier of the PO line item to book

* @return Reference to {@code this} so that method calls can be chained together. */ @Override @JsonSetter("purchase_order_line_item_id") public BookingIdStage purchaseOrderLineItemId(int purchaseOrderLineItemId) { this.purchaseOrderLineItemId = purchaseOrderLineItemId; return this; } /** *

Always required. The identifier of the booking to add the PO line item to

* @return Reference to {@code this} so that method calls can be chained together. */ @Override @JsonSetter("booking_id") public UnitsStage bookingId(int bookingId) { this.bookingId = bookingId; return this; } /** *

Always required. Number of units to book

* @return Reference to {@code this} so that method calls can be chained together. */ @Override @JsonSetter("units") public _FinalStage units(int units) { this.units = units; return this; } @Override public CreateBookingLineItem build() { return new CreateBookingLineItem(purchaseOrderLineItemId, bookingId, units); } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy