In the context of APEX programming,

What is a RestResource and a RestResourceDelegate?

I have seen a RestResource class with a method,

global static void doThisThing() {

and then in the RestResourceDelegate,

public static void doThisThing() {

Why is this?

1 Answer 1


This is a code design choice and is a general idea not one tied particularly to REST - see e.g. delegation pattern.

Hopefully it is being used for some reason in your code, because the simplest solution is usually the right choice and the delegation adds a bit of complexity. The core reason to use it would normally be that the logic needs to be executed from more than one place.

(Pattern names appearing in code can sometimes be helpful but other times can obscure what really matters which is the business domain terms.)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .