Class Pipeline<T>

  • Type Parameters:
    T - pipeline context type
    All Implemented Interfaces:
    IPipelineStage<T>

    public class Pipeline<T>
    extends Object
    implements IPipelineStage<T>
    Represent a very simple pipeline container for a list of executable tasks called "pipeline stages" (defined using IPipelineStage). This pipeline class can also be used a pipeline stage to create pipe hierarchies. For more sophisticated work flow needs, consider using a more advanced framework.
    Since:
    1.5.0
    Author:
    Pascal Essiembre
    • Constructor Detail

      • Pipeline

        public Pipeline()
        Constructor.
      • Pipeline

        public Pipeline​(List<IPipelineStage<T>> stages)
        Creates a new pipeline with the specified stages.
        Parameters:
        stages - the stages to execute
    • Method Detail

      • getStages

        public List<IPipelineStage<T>> getStages()
        Gets the pipeline stages.
        Returns:
        the pipeline stages
      • addStages

        public Pipeline<T> addStages​(List<IPipelineStage<T>> stages)
        Adds stages to the pipeline.
        Parameters:
        stages - pipeline stages to add
        Returns:
        this instance, for chaining
      • addStage

        public Pipeline<T> addStage​(IPipelineStage<T> stage)
        Adds a stage to the pipeline.
        Parameters:
        stage - pipeline stage to add
        Returns:
        this instance, for chaining
      • clearStages

        public void clearStages()
      • execute

        public boolean execute​(T context)
        Description copied from interface: IPipelineStage
        Executes this pipeline stage. Implementors are encouraged to throw PipelineException upon errors.
        Specified by:
        execute in interface IPipelineStage<T>
        Parameters:
        context - pipeline context
        Returns:
        whether to continue pipeline execution or stop (true to continue).