• 1Installation
  • 2Preliminary Knowledge
  • 3Create Triggers
  • 4Trigger Handler
  • 5Bulk Object
  • 6Find Specific Objects
  • 7Data Sharing
  • 8Catch All Events
  • 9Trigger Controller
  • 10Normal Trigger Event Handler
  • 11Trigger Context
  • 12Unit Test
  • 13Take Only Trigger Execution

Trap.apex

  • Docs
  • Tutorials
Getting started with Trap.apex

Preliminary Knowledge

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

Trap.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.

Also Trap.apex heavily relies on Stream.apex. It is best that you can try Stream.apex first.

Done