Enum Class «QRCodeErrorCorrection»
- All Implemented Interfaces:
Serializable,Comparable<QRCodeErrorCorrection>,Constable
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).
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionReturns the human-readable description of this error correction level.intgetID()Returns the integer ID associated with this error correction level.intReturns the approximate built-in redundancy as a percentage.static QRCodeErrorCorrectionvalueOf(int id) Returns the enum constant of this class associated with the specified integer ID.static QRCodeErrorCorrectionReturns the enum constant of this class with the specified name.static QRCodeErrorCorrection[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
L
QR Code error correction level L (~7% redundancy) -
M
QR Code error correction level M (~15% redundancy) -
Q
QR Code error correction level Q (~25% redundancy) -
H
QR Code error correction level H (~30% redundancy)
-
-
Method Details
-
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
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 nameNullPointerException- if the argument is null
-
valueOf
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 forM, 3 forQ, 4 forH.- Returns:
- the integer ID associated with this error correction level
- See Also:
-
getDescription
Returns the human-readable description of this error correction level."Low" for
L, "Medium" forM, "Quartile" forQ, "High" forH.- 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
-