Barcode Pick Async Mapper Product Provider

Defined in package com.scandit.datacapture.barcode.pick.data

Note

Barcode Pick is still in beta and may change in future versions of Scandit Data Capture SDK.

BarcodePickAsyncMapperProductProvider
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(
    products,
    (itemsData, callback) -> queryExecutor.execute(() -> {
        List<BarcodePickProductProviderCallbackItem> result = myDb.findAndMapProductsForItemsData(itemsData);
        callback.onData(result);
    })
);

Note

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()
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.