Label Definition Builder

Defined in package com.scandit.datacapture.label.capture

LabelDefinitionBuilder
class LabelDefinitionBuilder

Added 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 patterns, 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()
@NonNull SerialNumberBarcodeBuilder addSerialNumberBarcode()

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)
@NonNull LabelDefinitionBuilder addSerialNumberBarcode(
        @NonNull SerialNumberBarcode barcode)

Added in version 6.21.0

Adds a pre-configured serial number barcode field to the label definition.

serialNumberBarcode(name, func)
void serialNumberBarcode(@NonNull String name,
        @NonNull Function1<@NonNull SerialNumberBarcodeBuilder, @NonNull Unit> func)

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()
@NonNull PartNumberBarcodeBuilder addPartNumberBarcode()

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)
@NonNull LabelDefinitionBuilder addPartNumberBarcode(
        @NonNull PartNumberBarcode barcode)

Added in version 6.21.0

Adds a pre-configured part number barcode field to the label definition.

partNumberBarcode(name, func)
void partNumberBarcode(@NonNull String name,
        @NonNull Function1<@NonNull PartNumberBarcodeBuilder, @NonNull Unit> func)

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()
@NonNull ImeiOneBarcodeBuilder addImeiOneBarcode()

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)
@NonNull LabelDefinitionBuilder addImeiOneBarcode(@NonNull ImeiOneBarcode barcode)

Added in version 6.21.0

Adds a pre-configured IMEI-1 barcode field to the label definition.

imeiOneBarcode(name, func)
void imeiOneBarcode(@NonNull String name,
        @NonNull Function1<@NonNull ImeiOneBarcodeBuilder, @NonNull Unit> func)

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()
@NonNull ImeiTwoBarcodeBuilder addImeiTwoBarcode()

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)
@NonNull LabelDefinitionBuilder addImeiTwoBarcode(@NonNull ImeiTwoBarcode barcode)

Added in version 6.21.0

Adds a pre-configured IMEI-2 barcode field to the label definition.

imeiTwoBarcode(name, func)
void imeiTwoBarcode(@NonNull String name,
        @NonNull Function1<@NonNull ImeiTwoBarcodeBuilder, @NonNull Unit> func)

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()
@NonNull CustomBarcodeBuilder addCustomBarcode()

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)
@NonNull LabelDefinitionBuilder addCustomBarcode(@NonNull CustomBarcode barcode)

Added in version 6.21.0

Adds a pre-configured custom barcode field to the label definition.

customBarcode(name, func)
void customBarcode(@NonNull String name,
        @NonNull Function1<@NonNull CustomBarcodeBuilder, @NonNull Unit> func)

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()
@NonNull UnitPriceTextBuilder addUnitPriceText()

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)
@NonNull LabelDefinitionBuilder addUnitPriceText(@NonNull UnitPriceText text)

Added in version 6.21.0

Adds a pre-configured unit price text field to the label definition.

unitPriceText(name, func)
void unitPriceText(@NonNull String name,
        @NonNull Function1<@NonNull UnitPriceTextBuilder, @NonNull Unit> func)

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()
@NonNull TotalPriceTextBuilder addTotalPriceText()

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)
@NonNull LabelDefinitionBuilder addTotalPriceText(@NonNull TotalPriceText text)

Added in version 6.21.0

Adds a pre-configured total price text field to the label definition.

totalPriceText(name, func)
void totalPriceText(@NonNull String name,
        @NonNull Function1<@NonNull TotalPriceTextBuilder, @NonNull Unit> func)

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()
@NonNull WeightTextBuilder addWeightText()

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)
@NonNull LabelDefinitionBuilder addWeightText(@NonNull WeightText text)

Added in version 6.21.0

Adds a pre-configured weight text field to the label definition.

weightText(name, func)
void weightText(@NonNull String name,
        @NonNull Function1<@NonNull WeightTextBuilder, @NonNull Unit> func)

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()
@NonNull PackingDateTextBuilder addPackingDateText()

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)
@NonNull LabelDefinitionBuilder addPackingDateText(
        @NonNull PackingDateText text)

Added in version 6.21.0

Adds a pre-configured packing date text field to the label definition.

packingDateText(name, func)
void packingDateText(@NonNull String name,
        @NonNull Function1<@NonNull PackingDateTextBuilder, @NonNull Unit> func)

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()
@NonNull ExpiryDateTextBuilder addExpiryDateText()

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)
@NonNull LabelDefinitionBuilder addExpiryDateText(@NonNull ExpiryDateText text)

Added in version 6.21.0

Adds a pre-configured expiry date text field to the label definition.

expiryDateText(name, func)
void expiryDateText(@NonNull String name,
        @NonNull Function1<@NonNull ExpiryDateTextBuilder, @NonNull Unit> func)

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()
@NonNull DateTextBuilder addDateText()

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)
@NonNull LabelDefinitionBuilder addDateText(@NonNull DateText text)

Added in version 7.6.0

Adds a pre-configured date text field to the label definition.

dateText(name, func)
void dateText(@NonNull String name,
        @NonNull Function1<@NonNull DateTextBuilder, @NonNull Unit> func)

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()
@NonNull CustomTextBuilder addCustomText()

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)
@NonNull LabelDefinitionBuilder addCustomText(@NonNull CustomText text)

Added in version 6.21.0

Adds a pre-configured custom text field to the label definition.

customText(name, func)
void customText(@NonNull String name,
        @NonNull Function1<@NonNull CustomTextBuilder, @NonNull Unit> func)

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)
@NonNull LabelDefinitionBuilder setHiddenProperty(@NonNull String key,
        @NonNull Object value)

Added in version 6.21.0

Sets a hidden property to be used when creating the LabelDefinition object.

setHiddenProperties(hiddenProperties)
@NonNull LabelDefinitionBuilder setHiddenProperties(
        @NonNull Map<@NonNull String, @NonNull Object> hiddenProperties)

Added in version 6.21.0

Sets hidden properties to be used when creating the LabelDefinition object.

build(name)
@NonNull LabelDefinition build(@NonNull String name)

Added in version 6.21.0

Builds the LabelDefinition object with the given name.

buildFluent(name)
@NonNull LabelCaptureSettingsBuilder buildFluent(@NonNull String name)

Added in version 6.21.0

Builds the LabelDefinition object with the given name and returns a fluent builder for configuring label capture settings.