# Class BarcodeFormat

java.lang.Object
com.codename1.ai.vision.BarcodeFormat

public final class BarcodeFormat extends Object

The normalized symbology names `Barcode.getFormat()` reports, as constants instead of literals. Every backend maps its own vendor identifier onto one of these before the result reaches application code, and reports `UNKNOWN` for a symbology outside this set.

    scanner.process(VisionImage.encoded(jpeg)).ready(codes -> {
        for (Barcode code : codes) {
            if (BarcodeFormat.matches(code, BarcodeFormat.QR_CODE)) {
                Log.p("QR: " + code.getValue());
            } else if (BarcodeFormat.matches(code, BarcodeFormat.EAN_13,
                    BarcodeFormat.UPC_A)) {
                lookUpProduct(code.getValue());
            }
        }
    });

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `AZTEC`
  Aztec two-dimensional code, common on transit tickets.
  `static final String`
  `CODABAR`
  Codabar linear code, used by libraries and blood banks.
  `static final String`
  `CODE_128`
  Code 128 linear code, the usual choice for shipping labels.
  `static final String`
  `CODE_39`
  Code 39 linear code.
  `static final String`
  `CODE_93`
  Code 93 linear code.
  `static final String`
  `DATA_MATRIX`
  Data Matrix two-dimensional code, common on small parts.
  `static final String`
  `EAN_13`
  EAN-13 retail product code.
  `static final String`
  `EAN_8`
  EAN-8 retail product code.
  `static final String`
  `ITF`
  Interleaved 2 of 5 linear code.
  `static final String`
  `PDF417`
  PDF417 stacked code, used by driving licences and boarding passes.
  `static final String`
  `QR_CODE`
  QR code.
  `static final String`
  `UNKNOWN`
  Reported when the backend decoded a code whose symbology has no portable name here.
  `static final String`
  `UPC_A`
  UPC-A retail product code.
  `static final String`
  `UPC_E`
  UPC-E retail product code.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static boolean`
  `matches(Barcode barcode, String... formats)`
  Tests a decoded barcode against a set of accepted formats.

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### AZTEC

    public static final String AZTEC
    Aztec two-dimensional code, common on transit tickets.
    See Also:
      - Constant Field Values

  - ### CODABAR

    public static final String CODABAR
    Codabar linear code, used by libraries and blood banks.
    See Also:
      - Constant Field Values

  - ### CODE_39

    public static final String CODE_39
    Code 39 linear code.
    See Also:
      - Constant Field Values

  - ### CODE_93

    public static final String CODE_93
    Code 93 linear code.
    See Also:
      - Constant Field Values

  - ### CODE_128

    public static final String CODE_128
    Code 128 linear code, the usual choice for shipping labels.
    See Also:
      - Constant Field Values

  - ### DATA_MATRIX

    public static final String DATA_MATRIX
    Data Matrix two-dimensional code, common on small parts.
    See Also:
      - Constant Field Values

  - ### EAN_8

    public static final String EAN_8
    EAN-8 retail product code.
    See Also:
      - Constant Field Values

  - ### EAN_13

    public static final String EAN_13
    EAN-13 retail product code.
    See Also:
      - Constant Field Values

  - ### ITF

    public static final String ITF
    Interleaved 2 of 5 linear code.
    See Also:
      - Constant Field Values

  - ### PDF417

    public static final String PDF417
    PDF417 stacked code, used by driving licences and boarding passes.
    See Also:
      - Constant Field Values

  - ### QR_CODE

    public static final String QR_CODE
    QR code.
    See Also:
      - Constant Field Values

  - ### UPC_A

    public static final String UPC_A
    UPC-A retail product code.
    See Also:
      - Constant Field Values

  - ### UPC_E

    public static final String UPC_E
    UPC-E retail product code.
    See Also:
      - Constant Field Values

  - ### UNKNOWN

    public static final String UNKNOWN
    Reported when the backend decoded a code whose symbology has no portable name here.
    See Also:
      - Constant Field Values

- ## Method Details

  - ### matches

    public static boolean matches(Barcode barcode, String... formats)
    Tests a decoded barcode against a set of accepted formats. An empty or `null` format list accepts every symbology, which is what a general-purpose scanner wants.
    Parameters:
      `barcode` - observation to test, or `null`
      `formats` - accepted format constants
    Returns:
      `true` when the barcode's format is one of `formats`