Domain class template

The Domain class implementation in this chapter utilizes the FinancialForce.com Apex Enterprise Patterns library, which is open source and is included in the sample code of this chapter. 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 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 first thing to note is that the constructor for this ...

Get Force.com Enterprise Architecture - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.