org.swixml

Class TagLibrary

Known Direct Subclasses:
SwingTagLibrary

public abstract class TagLibrary
extends java.lang.Object

A skeletal impementation of a TagLibrary
A TagLibrary has a collection of Factories. Every Tag is mapped to a Factory which is used to build the java object during document parsing. Date: Dec 9, 2002
Version:
$Revision: 1.1 $
Author:
Wolf Paulus

Constructor Summary

TagLibrary()
Constructs a new TagLibrary and regisiters all factories.

Method Summary

Factory
getFactory(Class template)
Returns the Factory that is currently registered for the given Tag name
Factory
getFactory(String name)
Returns the Factory that is currently registered for the given Tag name
protected Method
getSetter(Class template, String name)
Returns a setter method by name for a specified template class
Map
getTagClasses()
protected Method
guessSetter(Class template, String name)
Returns a setter method by name for a specified template class
void
registerTag(String name, Class template)
Registers a class for the given tag name
void
registerTag(String name, Factory factory)
Registers a factory for the given tag name
protected abstract void
registerTags()
Registers all factories for the TagLibrary.
boolean
unregisterTag(String name)
Un-registers (removes) a registered tag.

Constructor Details

TagLibrary

public TagLibrary()
Constructs a new TagLibrary and regisiters all factories.

Method Details

getFactory

public Factory getFactory(Class template)
Returns the Factory that is currently registered for the given Tag name
Parameters:
template - Class
Returns:
Factory - regsitered for the given tag name

getFactory

public Factory getFactory(String name)
Returns the Factory that is currently registered for the given Tag name
Parameters:
name - String
Returns:
Factory - regsitered for the given tag name

getSetter

protected Method getSetter(Class template,
                           String name)
Returns a setter method by name for a specified template class
Parameters:
template - Class template class
name - Sting method name
Returns:
Method - a setter method for the given class.

getTagClasses

public Map getTagClasses()
Returns:
Map - all registered tags.
Use athe tag names to get to the factories

guessSetter

protected Method guessSetter(Class template,
                             String name)
Returns a setter method by name for a specified template class
Parameters:
template - Class template class
name - Sting attribute name
Returns:
Method - a setter method for the given class, able to modify the property.

registerTag

public void registerTag(String name,
                        Class template)
Registers a class for the given tag name
Parameters:
name - String the tag's name
template - Class the java class that represents the tag

registerTag

public void registerTag(String name,
                        Factory factory)
Registers a factory for the given tag name
Parameters:
name - String the tag's name
factory - FactoryFactory factory to create an Instance of the tag

registerTags

protected abstract void registerTags()
Registers all factories for the TagLibrary.

unregisterTag

public boolean unregisterTag(String name)
Un-registers (removes) a registered tag.
Parameters:
name - String the tag's name
Returns:
boolean true if tag was registered befoire and now successfuly removed.

Copyright B) 2002 - 2005 - Wolf Paulus - CarlsbadCubes.com . All rights reserved.