Barcode Capture Deserializer
Defined in package com.scandit.datacapture.barcode.capture.serialization
Warning
The deserialization API is not yet stable and will still change over the coming releases.
Note
This deserializer is not thread-safe, subsequent calls for the same settings, mode or overlay have to be called on the same thread.
- BarcodeCaptureDeserializer
class BarcodeCaptureDeserializer : DataCaptureModeDeserializer
Added in version 6.1.0
A deserializer to construct barcode capture from JSON. For most use cases it is enough to use BarcodeCapture.fromJson() which internally uses this deserializer. Using the deserializer gives the advantage of being able to listen to the deserialization events as they happen and potentially influence them. Additionally warnings can be read from the deserializer that would otherwise not be available.
- BarcodeCaptureDeserializer()
BarcodeCaptureDeserializer()Added in version 6.1.0
Creates a new deserializer object.
- listener
var listener: BarcodeCaptureDeserializerListener?
Added in version 6.1.0
The object informed about deserialization events.
- warnings
val warnings: List<String>
Added in version 6.1.0
The warnings produced during deserialization, for example which properties were not used during deserialization.
- modeFromJson(dataCaptureContext, jsonData)
fun modeFromJson(dataCaptureContext: DataCaptureContext, jsonData: String): BarcodeCapture
Added in version 6.1.0
Deserializes barcode capture from JSON.
An exception is thrown if the provided JSON does not contain required properties or contains properties of the wrong type.
- updateModeFromJson(mode, jsonData)
fun updateModeFromJson(mode: BarcodeCapture, jsonData: String): BarcodeCapture
Added in version 6.1.0
Takes an existing barcode capture and updates it by deserializing new or changed properties from JSON.
An exception is thrown if the provided JSON does not contain required properties or contains properties of the wrong type.
- settingsFromJson(jsonData)
fun settingsFromJson(jsonData: String): BarcodeCaptureSettings
Added in version 6.1.0
Deserializes barcode capture settings from JSON.
An exception is thrown if the provided JSON does not contain required properties or contains properties of the wrong type.
- updateSettingsFromJson(settings, jsonData)
fun updateSettingsFromJson(settings: BarcodeCaptureSettings, jsonData: String): BarcodeCaptureSettings
Added in version 6.1.0
Takes existing barcode capture settings and updates them by deserializing new or changed properties from JSON.
An exception is thrown if the provided JSON does not contain required properties or contains properties of the wrong type.
- overlayFromJson(mode, jsonData)
fun overlayFromJson(mode: BarcodeCapture, jsonData: String): BarcodeCaptureOverlay
Added in version 6.1.0
Deserializes a barcode capture overlay from JSON.
An exception is thrown if the provided JSON does not contain required properties or contains properties of the wrong type.
- updateOverlayFromJson(overlay, jsonData)
fun updateOverlayFromJson(overlay: BarcodeCaptureOverlay, jsonData: String): BarcodeCaptureOverlay
Added in version 6.1.0
Takes an existing barcode capture overlay and updates it by deserializing new or changed properties from JSON.
An exception is thrown if the provided JSON does not contain required properties or contains properties of the wrong type.