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

com.flexport.api.resources.shipment.requests.ShipmentsShareableRequest Maven / Gradle / Ivy

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

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

@JsonDeserialize(builder = ShipmentsShareableRequest.Builder.class)
public final class ShipmentsShareableRequest {
    private final Optional> shipmentIds;

    private int _cachedHashCode;

    ShipmentsShareableRequest(Optional> shipmentIds) {
        this.shipmentIds = shipmentIds;
    }

    /**
     * @return A list (length < 10) of the unique id for the shipment to be retrieved.
     */
    @JsonProperty("shipment_ids")
    public Optional> getShipmentIds() {
        return shipmentIds;
    }

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

    private boolean equalTo(ShipmentsShareableRequest other) {
        return shipmentIds.equals(other.shipmentIds);
    }

    @Override
    public int hashCode() {
        if (_cachedHashCode == 0) {
            _cachedHashCode = Objects.hash(this.shipmentIds);
        }
        return _cachedHashCode;
    }

    @Override
    public String toString() {
        return "ShipmentsShareableRequest{" + "shipmentIds: " + shipmentIds + "}";
    }

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

    @JsonIgnoreProperties(ignoreUnknown = true)
    public static final class Builder {
        private Optional> shipmentIds = Optional.empty();

        private Builder() {}

        public Builder from(ShipmentsShareableRequest other) {
            shipmentIds(other.getShipmentIds());
            return this;
        }

        @JsonSetter(value = "shipment_ids", nulls = Nulls.SKIP)
        public Builder shipmentIds(Optional> shipmentIds) {
            this.shipmentIds = shipmentIds;
            return this;
        }

        public Builder shipmentIds(List shipmentIds) {
            this.shipmentIds = Optional.of(shipmentIds);
            return this;
        }

        public ShipmentsShareableRequest build() {
            return new ShipmentsShareableRequest(shipmentIds);
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy