Barcode-Lib4J requires Java 11+

Enum Class «QRCodeErrorCorrection»

java.lang.Object
java.lang.Enum<QRCodeErrorCorrection>
de.vwsoft.barcodelib4j.twod.QRCodeErrorCorrection
All Implemented Interfaces:
Serializable, Comparable<QRCodeErrorCorrection>, Constable

public enum QRCodeErrorCorrection extends Enum<QRCodeErrorCorrection>
Enumeration of QR Code error correction levels.

QR Codes include built-in redundancy that allows them to remain readable even when partially damaged, dirty, or obscured. Higher error correction levels add more redundant data, enabling recovery from greater damage but requiring more space in the symbol.

The four standard levels are:

  • L - Low (~7% redundancy)
  • M - Medium (~15% redundancy)
  • Q - Quartile (~25% redundancy)
  • H - High (~30% redundancy)

The unique integer IDs (1-4) assigned to the constants can be used for efficient storage in files or databases. The IDs are small enough to be safely cast to byte if needed. See getID() and valueOf(int id).

  • Enum Constant Details

  • Method Details

    • values

      public static QRCodeErrorCorrection[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static QRCodeErrorCorrection valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • valueOf

      public static QRCodeErrorCorrection valueOf(int id)
      Returns the enum constant of this class associated with the specified integer ID.
      Parameters:
      id - the ID of the enum constant to be returned (1-4)
      Returns:
      the enum constant associated with the specified ID
      Throws:
      IllegalArgumentException - if this enum class has no constant associated with the specified ID
    • getID

      public int getID()
      Returns the integer ID associated with this error correction level.

      1 for L, 2 for M, 3 for Q, 4 for H.

      Returns:
      the integer ID associated with this error correction level
      See Also:
    • getDescription

      public String getDescription()
      Returns the human-readable description of this error correction level.

      "Low" for L, "Medium" for M, "Quartile" for Q, "High" for H.

      Returns:
      the human-readable description of this error correction level
    • getRedundancy

      public int getRedundancy()
      Returns the approximate built-in redundancy as a percentage.

      This value can be combined with getDescription() to create complete descriptions like "Medium (~15% redundancy)" for user interfaces or logging.

      Returns:
      the approximate built-in redundancy as a percentage