Class ItemProcessorPipeline
- java.lang.Object
-
- org.craftercms.core.processors.impl.ItemProcessorPipeline
-
- All Implemented Interfaces:
ItemProcessor
public class ItemProcessorPipeline extends Object implements ItemProcessor
Pipeline ofItemProcessor
s. The output of each processor'sItemProcessor.process(org.craftercms.core.service.Context, org.craftercms.core.service.CachingOptions, Item)
call is passed as input to the next processor.- Author:
- Sumer Jabri, Alfonso Vásquez
-
-
Field Summary
Fields Modifier and Type Field Description protected List<ItemProcessor>
processors
List of processors which conforms the pipeline
-
Constructor Summary
Constructors Constructor Description ItemProcessorPipeline()
Default no-args constructor.ItemProcessorPipeline(List<ItemProcessor> processors)
Constructor that receives the list of processors which conform the pipeline.ItemProcessorPipeline(ItemProcessor... processors)
Constructor that receives the list of processors (as an array) which conform the pipeline.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addProcessor(ItemProcessor processor)
Adds a processor to the pipeline of processors.void
addProcessors(Collection<ItemProcessor> processors)
Adds several processors to the pipeline of processors.boolean
equals(Object o)
Returns true if the specifiedItemProcessorPipeline
's and this instance's list of processors are equal.int
hashCode()
Returns the hash code for this instance, which is basically the hash code of the list of processors.Item
process(Context context, CachingOptions cachingOptions, Item item)
Processes the givenItem
, by calling a pipeline of processors.boolean
removeProcessor(ItemProcessor processor)
Removes a processor from the pipeline of processors.void
setProcessors(List<ItemProcessor> processors)
Sets the list of processors.String
toString()
-
-
-
Field Detail
-
processors
protected List<ItemProcessor> processors
List of processors which conforms the pipeline
-
-
Constructor Detail
-
ItemProcessorPipeline
public ItemProcessorPipeline()
Default no-args constructor.
-
ItemProcessorPipeline
@ConstructorProperties("processors") public ItemProcessorPipeline(List<ItemProcessor> processors)
Constructor that receives the list of processors which conform the pipeline.
-
ItemProcessorPipeline
@ConstructorProperties("processors") public ItemProcessorPipeline(ItemProcessor... processors)
Constructor that receives the list of processors (as an array) which conform the pipeline.
-
-
Method Detail
-
setProcessors
public void setProcessors(List<ItemProcessor> processors)
Sets the list of processors.
-
addProcessor
public void addProcessor(ItemProcessor processor)
Adds a processor to the pipeline of processors.
-
addProcessors
public void addProcessors(Collection<ItemProcessor> processors)
Adds several processors to the pipeline of processors.
-
removeProcessor
public boolean removeProcessor(ItemProcessor processor)
Removes a processor from the pipeline of processors.- Returns:
- true if the processor was removed
-
process
public Item process(Context context, CachingOptions cachingOptions, Item item) throws ItemProcessingException
Processes the givenItem
, by calling a pipeline of processors. The output of each processor'sItemProcessor.process(org.craftercms.core.service.Context, org.craftercms.core.service.CachingOptions, Item)
call is passed as input to the next processor.- Specified by:
process
in interfaceItemProcessor
- Parameters:
context
- the current contextcachingOptions
- caching options in case you need access to itemsitem
- the item to process- Returns:
- the result of the final processor in the pipeline.
- Throws:
ItemProcessingException
- if one of the processors in the pipeline couldn't process the item
-
equals
public boolean equals(Object o)
Returns true if the specifiedItemProcessorPipeline
's and this instance's list of processors are equal.
-
hashCode
public int hashCode()
Returns the hash code for this instance, which is basically the hash code of the list of processors. As with any otherItemProcessor
, this method is defined because any processor which is passed in the method call of aContentStoreService
can be used as part of a key for caching.
-
-