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 java.lang.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.
-
-
Constructor Summary
Constructors Constructor Description AbstractPipeline(Pipeline<?> next)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Pipeline<?>
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, java.lang.String text, ProcessObject po)
Just calls getNext.
Override this to get notified on encountered content.java.lang.String
getContextKey()
Defaults to the fully qualified class name of the object.T
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(Pipeline<?> next)
setNext method.
-
-
-
Field Detail
-
next
private Pipeline<?> next
-
-
Constructor Detail
-
AbstractPipeline
public AbstractPipeline(Pipeline<?> next)
- Parameters:
next
- the pipeline that's next in the sequence.
-
-
Method Detail
-
getNext
public Pipeline<?> 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
public Pipeline<?> open(WorkerContext context, Tag t, ProcessObject po) throws PipelineException
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, java.lang.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
public Pipeline<?> close(WorkerContext context, Tag t, ProcessObject po) throws PipelineException
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
public T getLocalContext(WorkerContext context) throws PipelineException
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
public void setNext(Pipeline<?> next)
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
public java.lang.String getContextKey()
Defaults to the fully qualified class name of the object.- Returns:
getClass().getName()
as name.
-
init
public Pipeline<?> init(WorkerContext context) throws PipelineException
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.
-
-