try {
switch (CODE_TYPE) {
case "UPC-A":
bitMatrix = new MultiFormatWriter().encode(Value, BarcodeFormat.UPC_A, BAR_CODE_HEIGHT, BAR_CODE_WIDTH, null);
break;
case "UPC-E":
bitMatrix = new MultiFormatWriter().encode(Value, BarcodeFormat.UPC_E, QR_CODE_WIDTH, QR_CODE_WIDTH, null);
break;
case "EAN-8":
bitMatrix = new MultiFormatWriter().encode(Value, BarcodeFormat.EAN_8, QR_CODE_WIDTH, QR_CODE_WIDTH, null);
break;
case "EAN-13":
bitMatrix = new MultiFormatWriter().encode(Value, BarcodeFormat.EAN_13, QR_CODE_WIDTH, QR_CODE_WIDTH, null);
break;
case "Code 39":
bitMatrix = new MultiFormatWriter().encode(Value, BarcodeFormat.CODE_39, QR_CODE_WIDTH, QR_CODE_WIDTH, null);
break;
case "Code 93":
bitMatrix = new MultiFormatWriter().encode(Value, BarcodeFormat.CODE_93, QR_CODE_WIDTH, QR_CODE_WIDTH, null);
break;
case "Code 128":
bitMatrix = new MultiFormatWriter().encode(Value, BarcodeFormat.CODE_128, BAR_CODE_WIDTH, BAR_CODE_HEIGHT, null);
break;
case "Codabar":
bitMatrix = new MultiFormatWriter().encode(Value, BarcodeFormat.CODABAR, QR_CODE_WIDTH, QR_CODE_WIDTH, null);
break;
case "ITF":
bitMatrix = new MultiFormatWriter().encode(Value, BarcodeFormat.ITF, QR_CODE_WIDTH, QR_CODE_WIDTH, null);
break;
case "RSS-14":
bitMatrix = new MultiFormatWriter().encode(Value, BarcodeFormat.RSS_14, QR_CODE_WIDTH, QR_CODE_WIDTH, null);
break;
case "RSS-Expanded":
bitMatrix = new MultiFormatWriter().encode(Value, BarcodeFormat.RSS_EXPANDED, QR_CODE_WIDTH, QR_CODE_WIDTH, null);
break;
// todo: we can leave here only next case lines ( "QR Code") and remove other barcode types
case "QR Code":
bitMatrix = new MultiFormatWriter().encode(Value, BarcodeFormat.QR_CODE, qr_width_pixels, qr_width_pixels, null);
break;
case "Data Matrix":
bitMatrix = new MultiFormatWriter().encode(Value, BarcodeFormat.DATA_MATRIX, QR_CODE_WIDTH, QR_CODE_WIDTH, null);
break;
default:
bitMatrix = new MultiFormatWriter().encode(Value, BarcodeFormat.CODE_128, QR_CODE_WIDTH, QR_CODE_WIDTH, null);
}