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 TagHandler
s 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:
- The package name (prefix)
- a period (dot - ".")
- the first letter of the tag name, upper cased
- the remaining characters of the tag name
- 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 TagHandler
s
to have a no-arg constructor.
- Since:
- 0.1.1a
- Author:
- Francois Beausoleil, fbos@users.sourceforge.net
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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.
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