Package com.itextpdf.tool.xml.pipeline
Class AbstractPipeline<T extends CustomContext>
java.lang.Object
com.itextpdf.tool.xml.pipeline.AbstractPipeline<T>
- Type Parameters:
T
- the type of CustomContext
- All Implemented Interfaces:
Pipeline<T>
- Direct Known Subclasses:
AutoDocPipeline
,CssResolverPipeline
,ElementHandlerPipeline
,HtmlPipeline
,PdfWriterPipeline
public abstract class AbstractPipeline<T extends CustomContext>
extends Object
implements Pipeline<T>
Abstract class with default implementations. Override this instead of
implementing Pipeline and let your pipeline override only the methods
relevant to your implementation.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionPipeline<?>
close
(WorkerContext context, Tag t, ProcessObject po) Just calls getNext.
Override this to get notified on encountered closing tags.Pipeline<?>
content
(WorkerContext ctx, Tag currentTag, String text, ProcessObject po) Just calls getNext.
Override this to get notified on encountered content.Defaults to the fully qualified class name of the object.getLocalContext
(WorkerContext context) Returns the local context for this class using getContextKey, override this together with getContextKey to change the key usage in case you want to add multiple identical pipelines to the worker.Pipeline<?>
getNext()
Returns the next pipeline in line.Pipeline<?>
init
(WorkerContext context) The init method allows implementation to initialize the pipeline.Pipeline<?>
open
(WorkerContext context, Tag t, ProcessObject po) Just calls getNext.
Override this to get notified on encountered opening tags.void
setNext method.
-
Field Details
-
next
-
-
Constructor Details
-
AbstractPipeline
- Parameters:
next
- the pipeline that's next in the sequence.
-
-
Method Details
-
getNext
Description copied from interface:Pipeline
Returns the next pipeline in line.- Specified by:
getNext
in interfacePipeline<T extends CustomContext>
- Returns:
- the next pipeline
-
open
Just calls getNext.
Override this to get notified on encountered opening tags.- Specified by:
open
in interfacePipeline<T extends CustomContext>
- Parameters:
context
- the WorkerContextt
- the Tagpo
- a processObject to putWritable
s in- Returns:
- the next pipeline in line
- Throws:
PipelineException
- can be thrown to indicate that something went wrong.
-
content
public Pipeline<?> content(WorkerContext ctx, Tag currentTag, String text, ProcessObject po) throws PipelineException Just calls getNext.
Override this to get notified on encountered content.- Specified by:
content
in interfacePipeline<T extends CustomContext>
- Parameters:
ctx
- the WorkerContextcurrentTag
- the Tagtext
- the contentpo
- a processObject to putWritable
s in- Returns:
- the next pipeline in line
- Throws:
PipelineException
- can be thrown to indicate that something went wrong.
-
close
Just calls getNext.
Override this to get notified on encountered closing tags.- Specified by:
close
in interfacePipeline<T extends CustomContext>
- Parameters:
context
- the WorkerContextt
- the Tagpo
- a processObject to putWritable
s in- Returns:
- the next pipeline in line
- Throws:
PipelineException
- can be thrown to indicate that something went wrong.
-
getLocalContext
Returns the local context for this class using getContextKey, override this together with getContextKey to change the key usage in case you want to add multiple identical pipelines to the worker.- Parameters:
context
- the WorkerContext- Returns:
- the local context for this class using
getContextKey()
- Throws:
PipelineException
- thrown when there is noCustomContext
or the CustomContext is null.
-
setNext
setNext method. When using this while parsing one can make live changes the pipeline structure. Use with caution.- Parameters:
next
- set the next pipeline
-
getContextKey
Defaults to the fully qualified class name of the object.- Returns:
getClass().getName()
as name.
-
init
Description copied from interface:Pipeline
The init method allows implementation to initialize the pipeline. e.g. Initialize their CustomContext here and add it to the WorkerContext throughWorkerContext.put(String, CustomContext)
.- Specified by:
init
in interfacePipeline<T extends CustomContext>
- Parameters:
context
- the WorkerContext- Returns:
- the next pipeline in line
- Throws:
PipelineException
- can be thrown to indicate that something went wrong.
-