com.itextpdf.tool.xml.html
Class DefaultTagProcessorFactory

java.lang.Object
  extended by com.itextpdf.tool.xml.html.DefaultTagProcessorFactory
All Implemented Interfaces:
TagProcessorFactory

public class DefaultTagProcessorFactory
extends Object
implements TagProcessorFactory

A Default implementation of the TagProcessorFactory that uses a map to store the TagProcessors. Within the same ClassLoaders 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)!

Author:
redlab_b

Nested Class Summary
protected  class DefaultTagProcessorFactory.FactoryObject
          Internal Object to keep TagProcessors.
 
Constructor Summary
DefaultTagProcessorFactory()
           
 
Method Summary
 void addProcessor(String className, String... tags)
          Add one tag processor that handles multiple tags.
 void addProcessor(String tag, String className)
          Add an unloaded TagProcessor.
 void addProcessor(String tag, TagProcessor processor)
          Add a loaded TagProcessor.
 void addProcessor(TagProcessor processor, String... tags)
          Add a tag processor and the tags it maps to.
 TagProcessor getProcessor(String tag, String nameSpace)
          Looks up a TagProcessor for the given tag.
protected  TagProcessor load(String className)
          Tries to load given processor with Class.forName
protected  TagProcessor load(String className, ClassLoader loader)
          Tries to load given processor with Class.forName
 void removeProcessor(String tag)
          Removes a TagProcessor for a specific tag.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultTagProcessorFactory

public DefaultTagProcessorFactory()
Method Detail

load

protected TagProcessor load(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(String className,
                            ClassLoader loader)
                     throws NoTagProcessorException
Tries to load given processor with Class.forName

Parameters:
className - fully qualified className
loader - the classloader to use
Returns:
the loaded tag processor
Throws:
NoTagProcessorException - if TagProcessor could not be loaded.

getProcessor

public TagProcessor getProcessor(String tag,
                                 String nameSpace)
Description copied from interface: TagProcessorFactory
Looks up a TagProcessor for the given tag.

Specified by:
getProcessor in interface TagProcessorFactory
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

public void addProcessor(String tag,
                         String className)
Add an unloaded TagProcessor.

Parameters:
tag - the tag the processor with the given className maps to
className - the fully qualified class name (class has to be found on classpath, will be loaded with Class.forName()

addProcessor

public void addProcessor(String tag,
                         TagProcessor processor)
Add a loaded TagProcessor.

Parameters:
tag - the tag the processor with the given className maps to
processor - the TagProcessor

addProcessor

public void addProcessor(TagProcessor processor,
                         String... tags)
Description copied from interface: TagProcessorFactory
Add a tag processor and the tags it maps to.

Specified by:
addProcessor in interface TagProcessorFactory
Parameters:
processor - the TagProcessor.
tags - tags this processor maps to.

addProcessor

public void addProcessor(String className,
                         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(String tag)
Description copied from interface: TagProcessorFactory
Removes a TagProcessor for a specific tag.

Specified by:
removeProcessor in interface TagProcessorFactory
Parameters:
tag - the tag to remove the processor for.


Copyright © 2015. All Rights Reserved.