• 1Installation
  • 2Preliminary Knowledge
  • 3G.apex Demo
  • 4G.apex Query
  • 5Create Object Types
  • 6Create Schema
  • 7Resolver Functions
  • 8Serve Query Request
  • 9Mutation
  • 10Parameters
  • 11Default Value
  • 12Aliases
  • 13Fragments
  • 14Variables
  • 15Directives

G.apex

  • Docs
  • Tutorials
Getting started with G.apex

Preliminary Knowledge

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

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