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

com.logicommerce.sdk.builders.order.OrderDeliveryBuilder Maven / Gradle / Ivy

There is a newer version: 2.1.1
Show newest version
package com.logicommerce.sdk.builders.order;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import com.logicommerce.sdk.builders.GeographicalZoneBuilder;
import com.logicommerce.sdk.enums.DeliveryType;
import com.logicommerce.sdk.models.order.OrderDelivery;
import com.logicommerce.sdk.models.order.implementations.OrderDeliveryImpl;

/**
 * 

OrderDeliveryBuilder class.

* * @author Logicommerce * @since 1.0.16 */ public class OrderDeliveryBuilder { private T parentBuilder; private DeliveryType type; private OrderDeliveryPhysicalLocationBuilder> physicalLocation; private List>> shipments; private GeographicalZoneBuilder> geographicalZone; private ProviderPickupPointPickingDocumentDeliveryBuilder> providerPickupPointPickingDocumentDelivery; /** *

Constructor for OrderDeliveryBuilder.

*/ public OrderDeliveryBuilder() { geographicalZone = new GeographicalZoneBuilder<>(this); shipments = new ArrayList<>(); physicalLocation = new OrderDeliveryPhysicalLocationBuilder<>(this); type = DeliveryType.SHIPPING; providerPickupPointPickingDocumentDelivery = new ProviderPickupPointPickingDocumentDeliveryBuilder<>(this); } /** *

Constructor for OrderDeliveryBuilder.

* * @param parentBuilder a T object */ public OrderDeliveryBuilder(T parentBuilder) { this(); this.parentBuilder = parentBuilder; } /** *

type.

* * @param type a {@link com.logicommerce.sdk.enums.DeliveryType} object * @return a {@link com.logicommerce.sdk.builders.order.OrderDeliveryBuilder} object */ public OrderDeliveryBuilder type(DeliveryType type) { this.type = type; return this; } /** *

geographicalZone.

* * @return a {@link com.logicommerce.sdk.builders.GeographicalZoneBuilder} object */ public GeographicalZoneBuilder> geographicalZone() { return this.geographicalZone; } /** *

physicalLocation.

* * @return a {@link com.logicommerce.sdk.builders.order.OrderDeliveryPhysicalLocationBuilder} object */ public OrderDeliveryPhysicalLocationBuilder> physicalLocation() { return this.physicalLocation; } /** *

shipments.

* * @return a {@link com.logicommerce.sdk.builders.order.OrderShipmentBuilder} object */ public OrderShipmentBuilder> shipments() { OrderShipmentBuilder> shipment = new OrderShipmentBuilder<>(this); shipments.add(shipment); return shipment; } /** *

providerPickupPointPickingDocumentDelivery.

* * @return a {@link com.logicommerce.sdk.builders.order.ProviderPickupPointPickingDocumentDeliveryBuilder} object */ public ProviderPickupPointPickingDocumentDeliveryBuilder> providerPickupPointPickingDocumentDelivery() { return this.providerPickupPointPickingDocumentDelivery; } /** *

build.

* * @return a {@link com.logicommerce.sdk.models.order.OrderDelivery} object */ public OrderDelivery build() { OrderDeliveryImpl delivery = new OrderDeliveryImpl(); delivery.setGeographicalZone(geographicalZone.build()); delivery.setPhysicalLocation(physicalLocation.build()); delivery.setShipments(shipments.stream().map(OrderShipmentBuilder::build).collect(Collectors.toList())); delivery.setType(type); delivery.setProviderPickupPointPickingDocumentDelivery(providerPickupPointPickingDocumentDelivery.build()); return delivery; } /** *

done.

* * @return a T object */ public T done() { return parentBuilder; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy