Sweet.apex

  • Docs
  • Tutorials
Docs Menu
  • Sweet.apex Core
    • Transpilation
    • Grammar
    • Command
    • Config
  • Features
    • Action
    • Apex Doc
    • Array Creation
    • Aspect
    • Cast
    • Default Value
    • Enum
    • File
    • Function
    • Identity
    • Injection
    • Lambda
    • Log
    • Mod
    • Not Null
    • Operator
    • Optional
    • Reflection
    • Rethrow
    • Switch
    • Template String
    • Template
    • Script
    • Tagged String
    • Annotation
    • Nullable
    • Var
    • Val
    • Map Access
    • Constructor
    • Transaction
    • Destructure
    • Import Static
    • Pipeline
    • Varargs
    • Patch
    • Import As
  • Plugin Development
    • Feature
    • Test Case

Pipeline Guide

Pipeline

Feature Overview

This feature enables you to combine Func calls into pipelines.

Prerequisite

You need to include R.apex if you want to enable this feature.

Sweet Apex Example

public class PipelineDemo {
    public static void main() {
        Integer val = 1
            |> R.inc
            |> R.add.apply(1);

        val = 2 |> R.inc;
    }
}

Transpiled Apex

public class PipelineDemo {
    public static void main() {
        Integer val = (Integer)((Func)R.add.apply(1)).run(((Func)R.inc).run(1));

        val = (Integer)((Func)R.inc).run(2);
    }
}

Usage

The data flows from top to bottom, left to right, running through each Func.

Contribute on Github! Edit this section.