Class ItemProcessorPipeline
java.lang.Object
org.craftercms.core.processors.impl.ItemProcessorPipeline
- All Implemented Interfaces:
ItemProcessor
Pipeline of
ItemProcessor
s. The output of each processor's
ItemProcessor.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
FieldsModifier and TypeFieldDescriptionprotected List<ItemProcessor>
List of processors which conforms the pipeline -
Constructor Summary
ConstructorsConstructorDescriptionDefault 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
Modifier and TypeMethodDescriptionvoid
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
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.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.toString()
-
Field Details
-
processors
List of processors which conforms the pipeline
-
-
Constructor Details
-
ItemProcessorPipeline
public ItemProcessorPipeline()Default no-args constructor. -
ItemProcessorPipeline
Constructor that receives the list of processors which conform the pipeline. -
ItemProcessorPipeline
Constructor that receives the list of processors (as an array) which conform the pipeline.
-
-
Method Details
-
setProcessors
Sets the list of processors. -
addProcessor
Adds a processor to the pipeline of processors. -
addProcessors
Adds several processors to the pipeline of processors. -
removeProcessor
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
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. -
toString
-