com.dft.api.shopify.model.ShopifyOrders Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of shopify-admin-rest Show documentation
Show all versions of shopify-admin-rest Show documentation
Shopify Admin REST API using JDK 11 and Reactive Programming
The newest version!
package com.dft.api.shopify.model;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class ShopifyOrders {
private final Map orderToShopifyOrder;
public ShopifyOrders(final List shopifyOrders) {
orderToShopifyOrder = new HashMap<>(shopifyOrders.size());
shopifyOrders.stream().forEach(shopifyOrder -> {
orderToShopifyOrder.put(shopifyOrder.getId(), shopifyOrder);
});
}
public ShopifyOrder get(final String orderId) {
return orderToShopifyOrder.get(orderId);
}
public List values() {
return new ArrayList<>(orderToShopifyOrder.values());
}
// public List getVariants() {
// final Collection shopifyProducts = productIdToShopifyProduct.values();
// final List shopifyVariants = new ArrayList<>(shopifyProducts.size());
// for (ShopifyProduct shopifyProduct : shopifyProducts) {
// shopifyVariants.addAll(shopifyProduct.getVariants());
// }
// return shopifyVariants;
// }
public int size() {
return orderToShopifyOrder.size();
}
public boolean containsKey(final String orderId) {
return orderToShopifyOrder.containsKey(orderId);
}
}