Skip to content

Commit ecde5c9

Browse files
committed
add ability to extend other methods
1 parent 6d8889d commit ecde5c9

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

sfdx-source/apex-common/main/classes/fflib_Application.cls

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ public virtual class fflib_Application
230230
* @param recordIds The SObject record Ids, must be all the same SObjectType
231231
* @exception Is thrown if the record Ids are not all the same or the SObjectType is not registered
232232
**/
233-
public List<SObject> selectById(Set<Id> recordIds)
233+
public virtual List<SObject> selectById(Set<Id> recordIds)
234234
{
235235
// No point creating an empty Domain class, nor can we determine the SObjectType anyway
236236
if(recordIds==null || recordIds.size()==0)
@@ -258,7 +258,7 @@ public virtual class fflib_Application
258258
* @param relatedRecords used to extract the related record Ids, e.g. Opportunity records
259259
* @param relationshipField field in the passed records that contains the relationship records to query, e.g. Opportunity.AccountId
260260
**/
261-
public List<SObject> selectByRelationship(List<SObject> relatedRecords, SObjectField relationshipField)
261+
public virtual List<SObject> selectByRelationship(List<SObject> relatedRecords, SObjectField relationshipField)
262262
{
263263
Set<Id> relatedIds = new Set<Id>();
264264
for(SObject relatedRecord : relatedRecords)
@@ -288,6 +288,11 @@ public virtual class fflib_Application
288288

289289
protected Map<Object, fflib_IDomain> mockDomainByObject;
290290

291+
/**
292+
* Constructs a Domain factory
293+
**/
294+
public DomainFactory() { }
295+
291296
/**
292297
* Constructs a Domain factory, using an instance of the Selector Factory
293298
* and a map of Apex classes implementing fflib_ISObjectDomain by SObjectType
@@ -408,18 +413,18 @@ public virtual class fflib_Application
408413
}
409414

410415
@TestVisible
411-
private virtual void setMock(fflib_ISObjectDomain mockDomain)
416+
protected virtual void setMock(fflib_ISObjectDomain mockDomain)
412417
{
413418
mockDomainByObject.put((Object) mockDomain.sObjectType(), (fflib_IDomain) mockDomain);
414419
}
415420

416421
@TestVisible
417-
private virtual void setMock(fflib_IDomain mockDomain)
422+
protected virtual void setMock(fflib_IDomain mockDomain)
418423
{
419424
mockDomainByObject.put(mockDomain.getType(), mockDomain);
420425
}
421426

422-
private Map<Object, Type> getConstructorTypeByObject(Map<SObjectType, Type> constructorTypeBySObjectType)
427+
protected virtual Map<Object, Type> getConstructorTypeByObject(Map<SObjectType, Type> constructorTypeBySObjectType)
423428
{
424429
Map<Object, Type> result = new Map<Object, Type>();
425430
for (SObjectType sObjectType : constructorTypeBySObjectType.keySet())

0 commit comments

Comments
 (0)