Barcode Pick Async Mapper Product Provider

Defined in package

class BarcodePickAsyncMapperProductProvider : BarcodePickProductProvider

Added in version 6.19.0

A product provider that takes on construction a list of products to pick and an async itemData to product mapper

Usage example:

HashSet<BarcodePickProduct> products = new HashSet<>();
products.add(new BarcodePickProduct("780846124122", 2));
products.add(new BarcodePickProduct("750865926478", 1));
products.add(new BarcodePickProduct("984579832123", 4));

Executor queryExecutor = Executors.newSingleThreadExecutor();

BarcodePickProductProvider productProvider = new BarcodePickAsyncMapperProductProvider(
    (itemsData, callback) -> queryExecutor.execute(() -> {
        List<BarcodePickProductProviderCallbackItem> result = myDb.findAndMapProductsForItemsData(itemsData);


Use your preferred way to retrieve the initial list of products to pick and to handle the async retrieval of products from itemsData. In this snippet we’re using a hardcoded set of products and an Executor with a fictitious myDb object for simplicity’s sake.

BarcodePickAsyncMapperProductProvider(@NonNull Set<@NonNull BarcodePickProduct> productsToPick,
        @NonNull BarcodePickAsyncMapperProductProviderCallback callback)

Added in version 6.19.0

Creates a new instance with the given set of BarcodePickProduct and callback to map items to products asynchronously.