Label Definition Builder
Defined in package com.scandit.datacapture.label.capture
- LabelDefinitionBuilder
class LabelDefinitionBuilderAdded in version 6.21.0
A fluent builder class for creating LabelDefinition objects with a convenient, chainable interface. This builder provides methods to add various field types (barcodes, text fields, dates) and configure their properties in a structured manner.
The LabelDefinitionBuilder enables you to construct complex label definitions by adding multiple field types:
Barcode Fields - Serial numbers, part numbers, IMEI codes, custom barcodes
Text Fields - Unit prices, total prices, weight information, custom text, date fields (for example, packing dates, expiry dates with configurable formats)
Each field can be configured with validation regexes, optional status, and symbology settings where applicable. The builder pattern ensures type safety and provides a clear, readable way to define label structures.
Note
This builder is the recommended approach for creating label definitions as it provides better type safety and readability compared to manual construction.
- addSerialNumberBarcode()
fun addSerialNumberBarcode(): SerialNumberBarcodeBuilder
Added in version 6.21.0
Adds a serial number barcode field to the label definition. Returns a builder for configuring the serial number field properties.
- addSerialNumberBarcode(barcode)
fun addSerialNumberBarcode(barcode: SerialNumberBarcode): LabelDefinitionBuilder
Added in version 6.21.0
Adds a pre-configured serial number barcode field to the label definition.
- serialNumberBarcode(name, func)
fun serialNumberBarcode(name: String, func: SerialNumberBarcodeBuilder.() -> Unit)
Added in version 6.21.0
Adds a serial number barcode field with a configuration function. This method allows for inline configuration of the serial number field properties.
- addPartNumberBarcode()
fun addPartNumberBarcode(): PartNumberBarcodeBuilder
Added in version 6.21.0
Adds a part number barcode field to the label definition. Returns a builder for configuring the part number field properties.
- addPartNumberBarcode(barcode)
fun addPartNumberBarcode(barcode: PartNumberBarcode): LabelDefinitionBuilder
Added in version 6.21.0
Adds a pre-configured part number barcode field to the label definition.
- partNumberBarcode(name, func)
fun partNumberBarcode(name: String, func: PartNumberBarcodeBuilder.() -> Unit)
Added in version 6.21.0
Adds a part number barcode field with a configuration function. This method allows for inline configuration of the part number field properties.
- addImeiOneBarcode()
fun addImeiOneBarcode(): ImeiOneBarcodeBuilder
Added in version 6.21.0
Adds an IMEI-1 barcode field to the label definition. Returns a builder for configuring the IMEI-1 field properties.
IMEI-1 barcodes are used for mobile device identification. This field type is specifically optimized for recognizing the first IMEI code format commonly found on device labels.
- addImeiOneBarcode(barcode)
fun addImeiOneBarcode(barcode: ImeiOneBarcode): LabelDefinitionBuilder
Added in version 6.21.0
Adds a pre-configured IMEI-1 barcode field to the label definition.
- imeiOneBarcode(name, func)
fun imeiOneBarcode(name: String, func: ImeiOneBarcodeBuilder.() -> Unit)
Added in version 6.21.0
Adds an IMEI-1 barcode field with a configuration function. This method allows for inline configuration of the IMEI-1 field properties.
- addImeiTwoBarcode()
fun addImeiTwoBarcode(): ImeiTwoBarcodeBuilder
Added in version 6.21.0
Adds an IMEI-2 barcode field to the label definition. Returns a builder for configuring the IMEI-2 field properties.
IMEI-2 barcodes are used for mobile device identification, specifically for the second IMEI code format. This field type is optimized for recognizing the alternative IMEI code format.
- addImeiTwoBarcode(barcode)
fun addImeiTwoBarcode(barcode: ImeiTwoBarcode): LabelDefinitionBuilder
Added in version 6.21.0
Adds a pre-configured IMEI-2 barcode field to the label definition.
- imeiTwoBarcode(name, func)
fun imeiTwoBarcode(name: String, func: ImeiTwoBarcodeBuilder.() -> Unit)
Added in version 6.21.0
Adds an IMEI-2 barcode field with a configuration function. This method allows for inline configuration of the IMEI-2 field properties.
- addCustomBarcode()
fun addCustomBarcode(): CustomBarcodeBuilder
Added in version 6.21.0
Adds a custom barcode field to the label definition. Returns a builder for configuring the custom barcode field properties.
- addCustomBarcode(barcode)
fun addCustomBarcode(barcode: CustomBarcode): LabelDefinitionBuilder
Added in version 6.21.0
Adds a pre-configured custom barcode field to the label definition.
- customBarcode(name, func)
fun customBarcode(name: String, func: CustomBarcodeBuilder.() -> Unit)
Added in version 6.21.0
Adds a custom barcode field with a configuration function. This method allows for inline configuration of the custom barcode field properties.
- addUnitPriceText()
fun addUnitPriceText(): UnitPriceTextBuilder
Added in version 6.21.0
Adds a unit price text field to the label definition. Returns a builder for configuring the unit price field properties.
- addUnitPriceText(text)
fun addUnitPriceText(text: UnitPriceText): LabelDefinitionBuilder
Added in version 6.21.0
Adds a pre-configured unit price text field to the label definition.
- unitPriceText(name, func)
fun unitPriceText(name: String, func: UnitPriceTextBuilder.() -> Unit)
Added in version 6.21.0
Adds a unit price text field with a configuration function. This method allows for inline configuration of the unit price field properties.
- addTotalPriceText()
fun addTotalPriceText(): TotalPriceTextBuilder
Added in version 6.21.0
Adds a total price text field to the label definition. Returns a builder for configuring the total price field properties.
- addTotalPriceText(text)
fun addTotalPriceText(text: TotalPriceText): LabelDefinitionBuilder
Added in version 6.21.0
Adds a pre-configured total price text field to the label definition.
- totalPriceText(name, func)
fun totalPriceText(name: String, func: TotalPriceTextBuilder.() -> Unit)
Added in version 6.21.0
Adds a total price text field with a configuration function. This method allows for inline configuration of the total price field properties.
- addWeightText()
fun addWeightText(): WeightTextBuilder
Added in version 6.21.0
Adds a weight text field to the label definition. Returns a builder for configuring the weight field properties.
- addWeightText(text)
fun addWeightText(text: WeightText): LabelDefinitionBuilder
Added in version 6.21.0
Adds a pre-configured weight text field to the label definition.
- weightText(name, func)
fun weightText(name: String, func: WeightTextBuilder.() -> Unit)
Added in version 6.21.0
Adds a weight text field with a configuration function. This method allows for inline configuration of the weight field properties.
- addPackingDateText()
fun addPackingDateText(): PackingDateTextBuilder
Added in version 6.21.0
Adds a packing date text field to the label definition. Returns a builder for configuring the packing date field properties.
- addPackingDateText(text)
fun addPackingDateText(text: PackingDateText): LabelDefinitionBuilder
Added in version 6.21.0
Adds a pre-configured packing date text field to the label definition.
- packingDateText(name, func)
fun packingDateText(name: String, func: PackingDateTextBuilder.() -> Unit)
Added in version 6.21.0
Adds a packing date text field with a configuration function. This method allows for inline configuration of the packing date field properties.
- addExpiryDateText()
fun addExpiryDateText(): ExpiryDateTextBuilder
Added in version 6.21.0
Adds an expiry date text field to the label definition. Returns a builder for configuring the expiry date field properties.
- addExpiryDateText(text)
fun addExpiryDateText(text: ExpiryDateText): LabelDefinitionBuilder
Added in version 6.21.0
Adds a pre-configured expiry date text field to the label definition.
- expiryDateText(name, func)
fun expiryDateText(name: String, func: ExpiryDateTextBuilder.() -> Unit)
Added in version 6.21.0
Adds an expiry date text field with a configuration function. This method allows for inline configuration of the expiry date field properties.
- addDateText()
fun addDateText(): DateTextBuilder
Added in version 7.6.0
Adds a date text field to the label definition. Returns a builder for configuring the date field properties.
- addDateText(text)
fun addDateText(text: DateText): LabelDefinitionBuilder
Added in version 7.6.0
Adds a pre-configured date text field to the label definition.
- dateText(name, func)
fun dateText(name: String, func: DateTextBuilder.() -> Unit)
Added in version 7.6.0
Adds a date text field with a configuration function. This method allows for inline configuration of the date field properties.
- addCustomText()
fun addCustomText(): CustomTextBuilder
Added in version 6.21.0
Adds a custom text field to the label definition. Returns a builder for configuring the custom text field properties.
- addCustomText(text)
fun addCustomText(text: CustomText): LabelDefinitionBuilder
Added in version 6.21.0
Adds a pre-configured custom text field to the label definition.
- customText(name, func)
fun customText(name: String, func: CustomTextBuilder.() -> Unit)
Added in version 6.21.0
Adds a custom text field with a configuration function. This method allows for inline configuration of the custom text field properties.
- setHiddenProperty(key, value)
fun setHiddenProperty(key: String, value: Any): LabelDefinitionBuilder
Added in version 6.21.0
Sets a hidden property to be used when creating the LabelDefinition object.
- setHiddenProperties(hiddenProperties)
fun setHiddenProperties(hiddenProperties: Map<String, Any>): LabelDefinitionBuilder
Added in version 6.21.0
Sets hidden properties to be used when creating the LabelDefinition object.
- adaptiveRecognition(adaptiveRecognitionMode)
fun adaptiveRecognition(adaptiveRecognitionMode: AdaptiveRecognitionMode): LabelDefinitionBuilder
Added in version 8.0.0
Sets the adaptive recognition mode for the label definition being built. Controls whether cloud-based processing is used as a backup for on-device processing. See AdaptiveRecognitionMode for available options.
- build(name)
fun build(name: String): LabelDefinition
Added in version 6.21.0
Builds the LabelDefinition object with the given name.
- buildFluent(name)
fun buildFluent(name: String): LabelCaptureSettingsBuilder
Added in version 6.21.0
Builds the LabelDefinition object with the given name and returns a fluent builder for configuring label capture settings.