• 1Installation
  • 2Preliminary Knowledge
  • 3Create Streams
  • 4Subscription
  • 5Lazy Streams
  • 6Stream Operations
  • 7Subjects

Stream.apex

  • Docs
  • Tutorials
Getting started with Stream.apex

Preliminary Knowledge

It's recommended that you have a fair amount of knowledge on R.apex, but it's not required.

Stream.apex uses Func objects from R.apex, and a Func is actually a custom Apex object that mimics the behavior of a function.

Here is how your implement a custom Func.

public class HelloWorldFunc extends Func {
    public HelloWorldFunc() {
        super(0); // specify the number of arguments the Func takes
    }

    // Provide custom implementation for a Func that takes 0 arguments.
    public override Object exec() {
        return 'Hello World';
    }
}

And then you instantiate, and invoke it.

Func helloworld = new HelloWorldFunc();
String msg = (String)helloworld.run();

To get deeper with Func objects, please check R.apex.

Done