barcode4j 2.1.0

org.krysalis.barcode4j
Class BarcodeUtil

java.lang.Object
  extended by org.krysalis.barcode4j.BarcodeUtil

public class BarcodeUtil
extends java.lang.Object

This is a convenience class to generate barcodes. It is implemented as Singleton to cache the BarcodeClassResolver. However, the class also contains a set of static methods which you can use of you manage your own BarcodeClassResolver.

Version:
$Id: BarcodeUtil.java,v 1.6 2012/01/27 14:36:35 jmaerki Exp $
Author:
Jeremias Maerki

Constructor Summary
protected BarcodeUtil()
          Creates a new BarcodeUtil object.
 
Method Summary
 BarcodeGenerator createBarcodeGenerator(org.apache.avalon.framework.configuration.Configuration cfg)
          Creates a BarcoderGenerator.
static BarcodeGenerator createBarcodeGenerator(org.apache.avalon.framework.configuration.Configuration cfg, BarcodeClassResolver classResolver)
          Creates a BarcoderGenerator.
 org.w3c.dom.DocumentFragment generateSVGBarcode(org.apache.avalon.framework.configuration.Configuration cfg, java.lang.String msg)
          Convenience method to create an SVG barocde as a DOM fragment.
 BarcodeClassResolver getClassResolver()
          Returns the class resolver used by this class.
static BarcodeUtil getInstance()
          Returns the default instance of this class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BarcodeUtil

protected BarcodeUtil()
Creates a new BarcodeUtil object. This constructor is protected because this class is designed as a singleton.

Method Detail

getInstance

public static BarcodeUtil getInstance()
Returns the default instance of this class.

Returns:
the singleton

getClassResolver

public BarcodeClassResolver getClassResolver()
Returns the class resolver used by this class.

Returns:
a BarcodeClassResolver instance

createBarcodeGenerator

public static BarcodeGenerator createBarcodeGenerator(org.apache.avalon.framework.configuration.Configuration cfg,
                                                      BarcodeClassResolver classResolver)
                                               throws BarcodeException,
                                                      org.apache.avalon.framework.configuration.ConfigurationException
Creates a BarcoderGenerator.

Parameters:
cfg - Configuration object that specifies the barcode to produce.
classResolver - The BarcodeClassResolver to use for lookup of barcode implementations.
Returns:
the newly instantiated BarcodeGenerator
Throws:
BarcodeException - if setting up a BarcodeGenerator fails
org.apache.avalon.framework.configuration.ConfigurationException - if something's wrong wth the configuration

createBarcodeGenerator

public BarcodeGenerator createBarcodeGenerator(org.apache.avalon.framework.configuration.Configuration cfg)
                                        throws org.apache.avalon.framework.configuration.ConfigurationException,
                                               BarcodeException
Creates a BarcoderGenerator.

Parameters:
cfg - Configuration object that specifies the barcode to produce.
Returns:
the newly instantiated BarcodeGenerator
Throws:
BarcodeException - if setting up a BarcodeGenerator fails
org.apache.avalon.framework.configuration.ConfigurationException - if something's wrong wth the configuration

generateSVGBarcode

public org.w3c.dom.DocumentFragment generateSVGBarcode(org.apache.avalon.framework.configuration.Configuration cfg,
                                                       java.lang.String msg)
                                                throws org.apache.avalon.framework.configuration.ConfigurationException,
                                                       BarcodeException
Convenience method to create an SVG barocde as a DOM fragment.

Parameters:
cfg - Configuration object that specifies the barcode to produce.
msg - message to encode.
Returns:
the requested barcode as an DOM fragment (SVG format)
Throws:
BarcodeException - if setting up a BarcodeGenerator fails
org.apache.avalon.framework.configuration.ConfigurationException - if something's wrong wth the configuration

barcode4j 2.1.0

Copyright © 2000-2010 Jeremias Maerki. All rights reserved.