Interface Pipeline

  • All Known Implementing Classes:
    DefaultPipeline

    public interface Pipeline
    Represents a pipeline of commands connected by operators such as pipes, redirections, and conditional connectors.

    A pipeline is built by chaining commands with operators:

     Pipeline pipeline = Pipeline.of("ls")
         .pipe("grep pattern")       // |
         .redirect(Path.of("out")) // > out
         .build();
     

    Pipelines are immutable once built. Use of(String) to start building a pipeline.

    Since:
    4.0
    See Also:
    Pipeline.Operator
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Interface Description
      static class  Pipeline.Operator
      Operators that connect commands in a pipeline.
      static interface  Pipeline.Stage
      A single stage in a pipeline, consisting of a command line and the operator that follows it.
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      boolean isBackground()
      Returns whether this pipeline should execute in the background.
      static PipelineBuilder of​(java.lang.String command)
      Starts building a new pipeline with the given command.
      java.lang.String source()
      Returns the original command line string that was parsed to create this pipeline.
      java.util.List<Pipeline.Stage> stages()
      Returns the ordered list of stages in this pipeline.
    • Method Detail

      • stages

        java.util.List<Pipeline.Stage> stages()
        Returns the ordered list of stages in this pipeline.
        Returns:
        the stages
      • source

        java.lang.String source()
        Returns the original command line string that was parsed to create this pipeline.
        Returns:
        the source command line
      • isBackground

        boolean isBackground()
        Returns whether this pipeline should execute in the background.
        Returns:
        true if background execution was requested
      • of

        static PipelineBuilder of​(java.lang.String command)
        Starts building a new pipeline with the given command.
        Parameters:
        command - the first command in the pipeline
        Returns:
        a new pipeline builder