Package com.itextpdf.tool.xml.html
Class DefaultTagProcessorFactory
- java.lang.Object
-
- com.itextpdf.tool.xml.html.DefaultTagProcessorFactory
-
- All Implemented Interfaces:
TagProcessorFactory
public class DefaultTagProcessorFactory extends java.lang.Object implements TagProcessorFactory
A Default implementation of the TagProcessorFactory that uses a map to store the TagProcessors. Within the sameClassLoaders this Processor can also load the processors when they are only stored with there fully qualified class names.
Note: this implementation does not use namespaces (yet)!
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classDefaultTagProcessorFactory.FactoryObjectInternal Object to keep TagProcessors.
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.String,DefaultTagProcessorFactory.FactoryObject>map
-
Constructor Summary
Constructors Constructor Description DefaultTagProcessorFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddProcessor(TagProcessor processor, java.lang.String... tags)Add a tag processor and the tags it maps to.voidaddProcessor(java.lang.String tag, TagProcessor processor)Add a loaded TagProcessor.voidaddProcessor(java.lang.String tag, java.lang.String className)Add an unloaded TagProcessor.voidaddProcessor(java.lang.String className, java.lang.String... tags)Add one tag processor that handles multiple tags.TagProcessorgetProcessor(java.lang.String tag, java.lang.String nameSpace)Looks up a TagProcessor for the given tag.protected TagProcessorload(java.lang.String className)Tries to load given processor with Class.forNameprotected TagProcessorload(java.lang.String className, java.lang.ClassLoader loader)Tries to load given processor with Class.forNamevoidremoveProcessor(java.lang.String tag)Removes a TagProcessor for a specific tag.
-
-
-
Field Detail
-
map
private final java.util.Map<java.lang.String,DefaultTagProcessorFactory.FactoryObject> map
-
-
Method Detail
-
load
protected TagProcessor load(java.lang.String className) throws NoTagProcessorException
Tries to load given processor with Class.forName- Parameters:
className- fully qualified className- Returns:
- the loaded tag processor
- Throws:
NoTagProcessorException- if TagProcessor could not be loaded.
-
load
protected TagProcessor load(java.lang.String className, java.lang.ClassLoader loader) throws NoTagProcessorException
Tries to load given processor with Class.forName- Parameters:
className- fully qualified classNameloader- the classloader to use- Returns:
- the loaded tag processor
- Throws:
NoTagProcessorException- if TagProcessor could not be loaded.
-
getProcessor
public TagProcessor getProcessor(java.lang.String tag, java.lang.String nameSpace)
Description copied from interface:TagProcessorFactoryLooks up a TagProcessor for the given tag.- Specified by:
getProcessorin interfaceTagProcessorFactory- Parameters:
tag- the tag to find a processor for.nameSpace- the namespace- Returns:
- the
TagProcessormapped to this tag. - Throws:
NoTagProcessorException- when the processor was not found for the given tag.
-
addProcessor
public void addProcessor(java.lang.String tag, java.lang.String className)Add an unloaded TagProcessor.- Parameters:
tag- the tag the processor with the given className maps toclassName- the fully qualified class name (class has to be found on classpath, will be loaded with Class.forName()
-
addProcessor
public void addProcessor(java.lang.String tag, TagProcessor processor)Add a loaded TagProcessor.- Parameters:
tag- the tag the processor with the given className maps toprocessor- the TagProcessor
-
addProcessor
public void addProcessor(TagProcessor processor, java.lang.String... tags)
Description copied from interface:TagProcessorFactoryAdd a tag processor and the tags it maps to.- Specified by:
addProcessorin interfaceTagProcessorFactory- Parameters:
processor- the TagProcessor.tags- tags this processor maps to.
-
addProcessor
public void addProcessor(java.lang.String className, java.lang.String... tags)Add one tag processor that handles multiple tags.- Parameters:
className- the fully qualified class name (class has to be found on classpath)tags- list of tags this processor maps to.
-
removeProcessor
public void removeProcessor(java.lang.String tag)
Description copied from interface:TagProcessorFactoryRemoves a TagProcessor for a specific tag.- Specified by:
removeProcessorin interfaceTagProcessorFactory- Parameters:
tag- the tag to remove the processor for.
-
-