complex-barcode/hibc-lic-combined-codetext.js

const {MwHIBCLICCombinedCodetext} = require("../_mwbridge/_mw-bridge");
const HIBCLICComplexCodetext = require("./hibc-lic-complex-codetext");
const SecondaryAndAdditionalData = require("./secondary-and-additional-data");
const PrimaryData = require("./primary-data");

/**
 * <p>
 * Class for encoding and decoding the text embedded in the HIBC LIC code which stores primary and secodary data.
 * </p>
 * This sample shows how to encode and decode HIBC LIC using HIBCLICCombinedCodetext.
 *
 * @example
 *
 * let combinedCodetext = new HIBCLICCombinedCodetext();
 * combinedCodetext.setBarcodeType(EncodeTypes.HIBCQRLIC);
 * combinedCodetext.setPrimaryData(new PrimaryData());
 * combinedCodetext.getPrimaryData().setProductOrCatalogNumber("12345");
 * combinedCodetext.getPrimaryData().setLabelerIdentificationCode("A999");
 * combinedCodetext.getPrimaryData().setUnitOfMeasureID(1);
 * combinedCodetext.setSecondaryAndAdditionalData(new SecondaryAndAdditionalData());
 * combinedCodetext.getSecondaryAndAdditionalData().setExpiryDate(new Date());
 * combinedCodetext.getSecondaryAndAdditionalData().setExpiryDateFormat(HIBCLICDateFormat.MMDDYY);
 * combinedCodetext.getSecondaryAndAdditionalData().setQuantity(30);
 * combinedCodetext.getSecondaryAndAdditionalData().setLotNumber("LOT123");
 * combinedCodetext.getSecondaryAndAdditionalData().setSerialNumber("SERIAL123");
 * combinedCodetext.getSecondaryAndAdditionalData().setDateOfManufacture(new Date());
 * ComplexBarcodeGenerator generator = new ComplexBarcodeGenerator(combinedCodetext);
 * let image = generator.generateBarCodeImage(BarCodeImageFormat.PNG);
 * let reader = new BarCodeReader(image, null, DecodeType.HIBCQRLIC);
 * reader.readBarCodes();
 * let codetext = reader.getFoundBarCodes()[0].getCodeText();
 * let result = ComplexCodetextReader.tryDecodeHIBCLIC(codetext) ;
 * print("Product or catalog number: " + result.getPrimaryData().getProductOrCatalogNumber());
 * print("Labeler identification code: " + result.getPrimaryData().getLabelerIdentificationCode());
 * print("Unit of measure ID: " + result.getPrimaryData().getUnitOfMeasureID());
 * print("Expiry date: " + result.getSecondaryAndAdditionalData().getExpiryDate());
 * print("Quantity: " + result.getSecondaryAndAdditionalData().getQuantity());
 * print("Lot number: " + result.getSecondaryAndAdditionalData().getLotNumber());
 * print("Serial number: " + result.getSecondaryAndAdditionalData().getSerialNumber());
 * print("Date of manufacture: " + result.getSecondaryAndAdditionalData().getDateOfManufacture());
 */
class HIBCLICCombinedCodetext extends HIBCLICComplexCodetext
{
    constructor()
    {
        super(new MwHIBCLICCombinedCodetext);
    }

    static _fromMwObject(mwObject)
    {
        let obj = new HIBCLICCombinedCodetext();
        obj.setJavaClass(mwObject);
        return obj;
    }

    _initializeWrapperMembers()
    {
        this.auto_PrimaryData = PrimaryData._fromMwObject(this.getJavaClass().getPrimaryDataSync());
        this.auto_SecondaryAndAdditionalData = SecondaryAndAdditionalData._fromMwObject(this.getJavaClass().getSecondaryAndAdditionalDataSync());
    }

    /**
     * <p>
     * Identifies primary data.
     * </p>
     */
    getPrimaryData()
    {
        return this.auto_PrimaryData;
    }

    /**
     * <p>
     * Identifies primary data.
     * </p>
     */
    setPrimaryData(value)
    {
        this.getJavaClass().setPrimaryDataSync(value.getJavaClass());
        this.auto_PrimaryData = value;
    }

    auto_PrimaryData;

    /**
     * <p>
     * Identifies secondary and additional supplemental data.
     * </p>
     */
    getSecondaryAndAdditionalData()
    {
        return this.auto_SecondaryAndAdditionalData;
    }

    /**
     * <p>
     * Identifies secondary and additional supplemental data.
     * </p>
     */
    setSecondaryAndAdditionalData(value)
    {
        this.getJavaClass().setSecondaryAndAdditionalDataSync(value.getJavaClass());
        this.auto_SecondaryAndAdditionalData = value;
    }

    auto_SecondaryAndAdditionalData;

    /**
     * <p>
     * Constructs codetext
     * </p>
     *
     * @return Constructed codetext
     */
    getConstructedCodetext()
    {
        return this.getJavaClass().getConstructedCodetextSync();
    }

    /**
     * <p>
     * Initializes instance from constructed codetext.
     * </p>
     *
     * @param constructedCodetext Constructed codetext.
     */
    initFromString(constructedCodetext)
    {
        this.getJavaClass().initFromStringSync(constructedCodetext);
    }

    /**
     * <p>
     * Returns a value indicating whether this instance is equal to a specified {@code HIBCLICCombinedCodetext} value.
     * </p>
     *
     * @param obj An {@code HIBCLICCombinedCodetext} value to compare to this instance.
     * @return {@code <b>true</b>} if obj has the same value as this instance; otherwise, {@code <b>false</b>}.
     */
    equals(obj)
    {
        return this.getJavaClass().equalsSync(obj.getJavaClass());
    }

    /**
     * <p>
     * Returns the hash code for this instance.
     * </p>
     *
     * @return A 32-bit signed integer hash code.
     */
    hashCode()
    {
        return this.getJavaClass().hashCodeSync();
    }
}
module.exports = HIBCLICCombinedCodetext