Apex Callable interface API

Later in this chapter, we will review a pattern whereby the FormulaForce package exposes a specific Apex interface for Developer X to implement to extend the business logic of the application. In doing so, however, the code written by Developer X becomes tightly coupled with the FormulaForce package since their code implements and thus references a specific interface contained in the package.

The System.Callable interface is included by Salesforce (so it doesn't need to be defined in your package) for situations where more loose coupling is more appropriate. The interface has only one method on it and is intentionally kept generic by design:

public Object call(String action, Map<String,Object> args)

The FormulaForce application is intentionally domain specific. It is only of interest to those working in the Formula 1 motor racing industry. However, if you were building a package that contains a tool or more generic application that would co-exist in a large ecosystem of different domains with other tools, you may want to consider supporting a more generally available interface such as this. In this case, Developer X would not have to explicitly depend on your package, and thus, this allows their code to be used by other packages that also support this interface, and they can also develop their code in isolation from your package without having to install it. You can read more about this interface at https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_interface_System_Callable.htm.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.24.106