- All Implemented Interfaces:
Serializable
Returns an exception ID from one of the three categories: Content, Checksum and Add-On. Some IDs are for general use, while others are reserved for specific barcode types.
Content related exceptions:
CONTENT_EMPTY
- Indicates empty content.CONTENT_INVALID
- States a general invalidity of the content.CONTENT_NOT_DIGITS
- Indicates that the content contains non-digit characters.CONTENT_NOT_ASCII
- Indicates that the content contains non-ASCII characters.CONTENT_LENGTH_INVALID
- Indicates an invalid content length.CONTENT_LENGTH_NOT_EVEN
- Indicates that the content length is not even.
CHECKSUM_INVALID
- Indicates an invalid checksum.
ADDON_EMPTY
- Indicates empty add-on content.ADDON_LENGTH_INVALID
- Indicates an invalid add-on length.ADDON_NOT_DIGITS
- Indicates that the add-on content contains non-digit characters.
If you prefer to determine which of the three categories an exception belongs to, rather than
handle each exception ID separately, you can use the three corresponding methods
isContentRelated()
, isChecksumRelated()
and isAddOnRelated()
provided in this class.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Exception ID indicating empty add-on content.static final int
Exception ID indicating an invalid add-on length.static final int
Exception ID indicating non-digit characters in the add-on content.static final int
Exception ID indicating an invalid checksum.static final int
Exception ID indicating empty content.static final int
Exception ID indicating general invalidity of the content.static final int
Exception ID indicating an invalid content length.static final int
Exception ID indicating an uneven content length.static final int
Exception ID indicating non-ASCII characters in the content.static final int
Exception ID indicating non-digit characters in the content. -
Constructor Summary
ConstructorDescriptionBarcodeException
(int id, String message, String messageDE, Object... inserts) Constructs aBarcodeException
with the specified ID, message, and optional inserts. -
Method Summary
Modifier and TypeMethodDescriptionint
getID()
Returns the exception ID associated with this exception.Returns the localized message for this exception.boolean
Returns whether the exception is add-on related.boolean
Returns whether the exception is checksum related.boolean
Returns whether the exception is content related.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Field Details
-
CONTENT_EMPTY
public static final int CONTENT_EMPTYException ID indicating empty content. -
CONTENT_INVALID
public static final int CONTENT_INVALIDException ID indicating general invalidity of the content. -
CONTENT_NOT_DIGITS
public static final int CONTENT_NOT_DIGITSException ID indicating non-digit characters in the content. -
CONTENT_NOT_ASCII
public static final int CONTENT_NOT_ASCIIException ID indicating non-ASCII characters in the content. -
CONTENT_LENGTH_INVALID
public static final int CONTENT_LENGTH_INVALIDException ID indicating an invalid content length. -
CONTENT_LENGTH_NOT_EVEN
public static final int CONTENT_LENGTH_NOT_EVENException ID indicating an uneven content length. -
CHECKSUM_INVALID
public static final int CHECKSUM_INVALIDException ID indicating an invalid checksum. -
ADDON_EMPTY
public static final int ADDON_EMPTYException ID indicating empty add-on content. -
ADDON_LENGTH_INVALID
public static final int ADDON_LENGTH_INVALIDException ID indicating an invalid add-on length. -
ADDON_NOT_DIGITS
public static final int ADDON_NOT_DIGITSException ID indicating non-digit characters in the add-on content.
-
-
Constructor Details
-
BarcodeException
Constructs aBarcodeException
with the specified ID, message, and optional inserts.The optional
inserts
can be used to dynamically insert values into the message text. Use "%s" as a placeholder in the message where the insert should be placed. The order of the inserts should correspond to the order of the placeholders in the message. For example, if the message is "Invalid value at position %s: %s", you can provide the position and the invalid value as inserts.- Parameters:
id
- the exception ID that categorizes the exceptionmessage
- the detailed message explaining the exceptionmessageDE
- the German translation of the messageinserts
- optional parameters to be inserted into the message
-
-
Method Details
-
getID
public int getID()Returns the exception ID associated with this exception.- Returns:
- the exception ID associated with this exception
-
getLocalizedMessage
Returns the localized message for this exception. If the default locale is German, it returns the German message. Otherwise, it returns the standard message.- Overrides:
getLocalizedMessage
in classThrowable
- Returns:
- the localized message for this exception
-
isContentRelated
public boolean isContentRelated()Returns whether the exception is content related.- Returns:
- whether the exception is content related
-
isChecksumRelated
public boolean isChecksumRelated()Returns whether the exception is checksum related.- Returns:
- whether the exception is checksum related
-
isAddOnRelated
public boolean isAddOnRelated()Returns whether the exception is add-on related.- Returns:
- whether the exception is add-on related
-