Class ChainBuilder<I,O>

java.lang.Object
ca.mcscert.jpipe.compiler.model.ChainBuilder<I,O>
Type Parameters:
I - input type of the chain (type produced by the Source).
O - current output type (changes with each andThen call).

public final class ChainBuilder<I,O> extends Object
Fluent builder that accumulates Transformations into a compilation chain. Call andThen(Transformation) to append steps; finalise with andThen(Sink) to produce a ChainCompiler.
  • Method Details

    • andThen

      public <R> ChainBuilder<I,R> andThen(Transformation<O,R> next)
      Append a transformation to the end of the current chain.
      Type Parameters:
      R - new output type.
      Parameters:
      next - the step to add.
      Returns:
      a new builder with the extended chain.
    • andThen

      public ChainCompiler<I,O> andThen(Sink<O> sink)
      Finalise the chain by attaching a sink, producing a ready-to-use Compiler.
      Parameters:
      sink - the final serialisation step.
      Returns:
      a complete ChainCompiler.
    • asTransformation

      public Transformation<I,O> asTransformation()
      Expose the accumulated chain as a plain Transformation, useful when the chain is embedded inside a larger pipeline rather than used standalone.
      Returns:
      the composed transformation.