Package com.itextpdf.tool.xml.html
Class DefaultTagProcessorFactory
java.lang.Object
com.itextpdf.tool.xml.html.DefaultTagProcessorFactory
- All Implemented Interfaces:
TagProcessorFactory
A Default implementation of the TagProcessorFactory that uses a map to store
the TagProcessors. Within the same
Note: this implementation does not use namespaces (yet)!
ClassLoader
s 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 ClassesModifier and TypeClassDescriptionprotected final class
Internal Object to keep TagProcessors. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Map<String,
DefaultTagProcessorFactory.FactoryObject> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addProcessor
(TagProcessor processor, String... tags) Add a tag processor and the tags it maps to.void
addProcessor
(String tag, TagProcessor processor) Add a loaded TagProcessor.void
addProcessor
(String tag, String className) Add an unloaded TagProcessor.void
addProcessor
(String className, String... tags) Add one tag processor that handles multiple tags.getProcessor
(String tag, String nameSpace) Looks up a TagProcessor for the given tag.protected TagProcessor
Tries to load given processor with Class.forNameprotected TagProcessor
load
(String className, ClassLoader loader) Tries to load given processor with Class.forNamevoid
removeProcessor
(String tag) Removes a TagProcessor for a specific tag.
-
Field Details
-
map
-
-
Constructor Details
-
DefaultTagProcessorFactory
public DefaultTagProcessorFactory()
-
-
Method Details
-
load
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
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
Description copied from interface:TagProcessorFactory
Looks up a TagProcessor for the given tag.- Specified by:
getProcessor
in interfaceTagProcessorFactory
- Parameters:
tag
- the tag to find a processor for.nameSpace
- the namespace- Returns:
- the
TagProcessor
mapped to this tag. - Throws:
NoTagProcessorException
- when the processor was not found for the given tag.
-
addProcessor
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
Add a loaded TagProcessor.- Parameters:
tag
- the tag the processor with the given className maps toprocessor
- the TagProcessor
-
addProcessor
Description copied from interface:TagProcessorFactory
Add a tag processor and the tags it maps to.- Specified by:
addProcessor
in interfaceTagProcessorFactory
- Parameters:
processor
- the TagProcessor.tags
- tags this processor maps to.
-
addProcessor
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
Description copied from interface:TagProcessorFactory
Removes a TagProcessor for a specific tag.- Specified by:
removeProcessor
in interfaceTagProcessorFactory
- Parameters:
tag
- the tag to remove the processor for.
-