jgb.factories.swing
Class PackageTagHandlerFactory

java.lang.Object
  |
  +--jgb.factories.swing.PackageTagHandlerFactory
All Implemented Interfaces:
TagHandlerFactory

public class PackageTagHandlerFactory
extends Object
implements TagHandlerFactory

Implementation of TagHandlerFactory that returns TagHandlers based on a package name and class suffix. This factory will use the following formula to build the fully-qualified name of the class to instantiate:

  1. The package name (prefix)
  2. a period (dot - ".")
  3. the first letter of the tag name, upper cased
  4. the remaining characters of the tag name
  5. the suffix
For example, if an instance of this factory was created with the package name equal to "com.xyz.handlers" and the suffix equal to "XmlTagHandler", getHandlerFor(String) would return an instance of com.xyz.handlers.WindowsXmlTagHandler if the tag name was equal to windows.
This factory expects all TagHandlers to have a no-arg constructor.

Since:
0.1.1a
Author:
Francois Beausoleil, fbos@users.sourceforge.net

Constructor Summary
PackageTagHandlerFactory(String basePackageName, String classSuffix)
           
 
Method Summary
 jgb.builder.TagHandler getHandlerFor(String tagName)
          Returns a TagHandler for the named tag.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PackageTagHandlerFactory

public PackageTagHandlerFactory(String basePackageName,
                                String classSuffix)
Parameters:
basePackageName - A String that will be prepended to the final class name before instantiation.
classSuffix - A String that will be appended to the final class name before instantiation.
Method Detail

getHandlerFor

public jgb.builder.TagHandler getHandlerFor(String tagName)
                                     throws ClassNotFoundException
Description copied from interface: TagHandlerFactory
Returns a TagHandler for the named tag. This method must return the same instance each time it is called with the same argument. This way, tag handlers can store information in their instance variables, although this is discouraged.

Specified by:
getHandlerFor in interface TagHandlerFactory
Throws:
ClassNotFoundException - If the named tag does not exist or is not understood by this factory.


Copyright 2002-2003, François Beausoleil, All Rights Reserved