Domain class template
The implementation of the Domain class in this chapter utilizes the Apex Enterprise Patterns library, which is open source and is included in the sample code of this chapter within the /classes/libs/apex-common
folder. In this library, the Apex base class, fflib_SObjectDomain
, is provided to help implement the Domain layer pattern.
A basic template for a Domain class utilizing this base class is shown in the following code snippet:
public inherited sharing class Races extends fflib_SObjectDomain {
public Races(List<Race__c> races) {
super(races);
}
public class Constructor
implements fflib_SObjectDomain.IConstructable {
public fflib_SObjectDomain construct(
List<SObject> sObjectList) {
return new Races(sObjectList);
}
}
}
The above example and those in this chapter use the CDCL approach that combines all Apex Trigger logic and other relevant logic pertaining to the object into...