net.sourceforge.jbarcodebean.model
Interface BarcodeStrategy

All Known Implementing Classes:
AbstractBarcodeStrategy, BaseCode39, Codabar, Codabar_2to1, Code11, Code128, Code39, Code39_2to1, Code93, Code93Extended, Ean13, Ean8, ExtendedCode39, ExtendedCode39_2to1, Interleaved25, Interleaved25_2to1, MSI

public interface BarcodeStrategy

Interface which defines the barcode strategy for any given type of barcode. Classes that implement this interface exist for each of the barcode types such as Code39, Interleaved25, etc.


Field Summary
static int MANDATORY_CHECKSUM
          When returned by requiresChecksum(), indicates that this type of barcode always has a checksum.
static int NO_CHECKSUM
          When returned by requiresChecksum(), indicates that this type of barcode does not support a checksum.
static int OPTIONAL_CHECKSUM
          When returned by requiresChecksum(), indicates that this type of barcode may have an optional checksum.
 
Method Summary
 EncodedBarcode encode(java.lang.String text, boolean checked)
          Subclasses implement this method to encode some text into a barcode.
 int requiresChecksum()
          Subclasses implement this method to determine whether this type of barcode has a mandatory, optional or no checksum.
 

Field Detail

NO_CHECKSUM

static final int NO_CHECKSUM
When returned by requiresChecksum(), indicates that this type of barcode does not support a checksum.

See Also:
Constant Field Values

MANDATORY_CHECKSUM

static final int MANDATORY_CHECKSUM
When returned by requiresChecksum(), indicates that this type of barcode always has a checksum.

See Also:
Constant Field Values

OPTIONAL_CHECKSUM

static final int OPTIONAL_CHECKSUM
When returned by requiresChecksum(), indicates that this type of barcode may have an optional checksum.

See Also:
Constant Field Values
Method Detail

encode

EncodedBarcode encode(java.lang.String text,
                      boolean checked)
                      throws BarcodeException
Subclasses implement this method to encode some text into a barcode.

Parameters:
text - The raw text to encode.
checked - true if a checksum is to be calculated, false if not.
Returns:
The fully encoded barcode, represented as bars and spaces, wrapped in a EncodedBarcode object.
Throws:
BarcodeException - Typically caused by passing in a String containing illegal characters (characters that cannot be encoded in this type of barcode).

requiresChecksum

int requiresChecksum()
Subclasses implement this method to determine whether this type of barcode has a mandatory, optional or no checksum. Returns one of the constants defined in the interface.



Copyright © 2004-2009 The JBarcodeBean project. All Rights Reserved.