2929 * of the Apex Enterprise Patterns, Service, Unit Of Work, Selector and Domain.
3030 * See the sample applications Application.cls file for an example
3131 **/
32+ @NamespaceAccessible
3233public virtual class fflib_Application
3334{
3435 /**
3536 * Class implements a Unit of Work factory
3637 **/
38+ @NamespaceAccessible
3739 public virtual class UnitOfWorkFactory implements fflib_IUnitOfWorkFactory
3840 {
41+ @NamespaceAccessible
3942 protected List <SObjectType > m_objectTypes ;
43+ @NamespaceAccessible
4044 protected fflib_ISObjectUnitOfWork m_mockUow ;
4145
4246 /**
4347 * Constructs a Unit Of Work factory
4448 **/
49+ @NamespaceAccessible
4550 public UnitOfWorkFactory () { }
4651
4752 /**
4853 * Constructs a Unit Of Work factory
4954 *
5055 * @param objectTypes List of SObjectTypes in dependency order
5156 **/
57+ @NamespaceAccessible
5258 public UnitOfWorkFactory (List <SObjectType > objectTypes )
5359 {
5460 m_objectTypes = objectTypes .clone ();
@@ -59,6 +65,7 @@ public virtual class fflib_Application
5965 * SObjectType list provided in the constructor, returns a Mock implementation
6066 * if set via the setMock method
6167 **/
68+ @NamespaceAccessible
6269 public virtual fflib_ISObjectUnitOfWork newInstance ()
6370 {
6471 // Mock?
@@ -72,6 +79,7 @@ public virtual class fflib_Application
7279 * SObjectType list provided in the constructor, returns a Mock implementation
7380 * if set via the setMock method
7481 **/
82+ @NamespaceAccessible
7583 public virtual fflib_ISObjectUnitOfWork newInstance (fflib_SObjectUnitOfWork.IDML dml )
7684 {
7785 // Mock?
@@ -88,6 +96,7 @@ public virtual class fflib_Application
8896 * @remark If mock is set, the list of SObjectType in the mock could be different
8997 * than the list of SObjectType specified in this method call
9098 **/
99+ @NamespaceAccessible
91100 public virtual fflib_ISObjectUnitOfWork newInstance (List <SObjectType > objectTypes )
92101 {
93102 // Mock?
@@ -104,6 +113,7 @@ public virtual class fflib_Application
104113 * @remark If mock is set, the list of SObjectType in the mock could be different
105114 * than the list of SObjectType specified in this method call
106115 **/
116+ @NamespaceAccessible
107117 public virtual fflib_ISObjectUnitOfWork newInstance (List <SObjectType > objectTypes , fflib_SObjectUnitOfWork.IDML dml )
108118 {
109119 // Mock?
@@ -113,6 +123,7 @@ public virtual class fflib_Application
113123 }
114124
115125 @TestVisible
126+ @NamespaceAccessible
116127 protected virtual void setMock (fflib_ISObjectUnitOfWork mockUow )
117128 {
118129 m_mockUow = mockUow ;
@@ -122,15 +133,19 @@ public virtual class fflib_Application
122133 /**
123134 * Simple Service Factory implementation
124135 **/
136+ @NamespaceAccessible
125137 public virtual class ServiceFactory implements fflib_IServiceFactory
126138 {
139+ @NamespaceAccessible
127140 protected Map <Type , Type > m_serviceInterfaceTypeByServiceImplType ;
128141
142+ @NamespaceAccessible
129143 protected Map <Type , Object > m_serviceInterfaceTypeByMockService ;
130144
131145 /**
132146 * Constructs a simple Service Factory
133147 **/
148+ @NamespaceAccessible
134149 public ServiceFactory () { }
135150
136151 /**
@@ -141,6 +156,7 @@ public virtual class fflib_Application
141156 *
142157 * @param serviceInterfaceTypeByServiceImplType Map of interfaces to classes
143158 **/
159+ @NamespaceAccessible
144160 public ServiceFactory (Map <Type , Type > serviceInterfaceTypeByServiceImplType )
145161 {
146162 m_serviceInterfaceTypeByServiceImplType = serviceInterfaceTypeByServiceImplType ;
@@ -155,6 +171,7 @@ public virtual class fflib_Application
155171 * @param serviceInterfaceType Apex interface type
156172 * @exception Is thrown if there is no registered Apex class for the interface type
157173 **/
174+ @NamespaceAccessible
158175 public virtual Object newInstance (Type serviceInterfaceType )
159176 {
160177 // Mock implementation?
@@ -169,6 +186,7 @@ public virtual class fflib_Application
169186 }
170187
171188 @TestVisible
189+ @NamespaceAccessible
172190 protected virtual void setMock (Type serviceInterfaceType , Object serviceImpl )
173191 {
174192 m_serviceInterfaceTypeByMockService .put (serviceInterfaceType , serviceImpl );
@@ -178,14 +196,18 @@ public virtual class fflib_Application
178196 /**
179197 * Class implements a Selector class factory
180198 **/
199+ @NamespaceAccessible
181200 public virtual class SelectorFactory implements fflib_ISelectorFactory
182201 {
202+ @NamespaceAccessible
183203 protected Map <SObjectType , Type > m_sObjectBySelectorType ;
204+ @NamespaceAccessible
184205 protected Map <SObjectType , fflib_ISObjectSelector > m_sObjectByMockSelector ;
185206
186207 /**
187208 * Constructs a simple Selector Factory
188209 **/
210+ @NamespaceAccessible
189211 public SelectorFactory () { }
190212
191213 /**
@@ -195,6 +217,7 @@ public virtual class fflib_Application
195217 *
196218 * @param sObjectBySelectorType Map of SObjectType's to Selector Apex Classes
197219 **/
220+ @NamespaceAccessible
198221 public SelectorFactory (Map <SObjectType , Type > sObjectBySelectorType )
199222 {
200223 m_sObjectBySelectorType = sObjectBySelectorType ;
@@ -207,6 +230,7 @@ public virtual class fflib_Application
207230 *
208231 * @param sObjectType An SObjectType token, e.g. Account.SObjectType
209232 **/
233+ @NamespaceAccessible
210234 public virtual fflib_ISObjectSelector newInstance (SObjectType sObjectType )
211235 {
212236 // Mock implementation?
@@ -230,6 +254,7 @@ public virtual class fflib_Application
230254 * @param recordIds The SObject record Ids, must be all the same SObjectType
231255 * @exception Is thrown if the record Ids are not all the same or the SObjectType is not registered
232256 **/
257+ @NamespaceAccessible
233258 public virtual List <SObject > selectById (Set <Id > recordIds )
234259 {
235260 // No point creating an empty Domain class, nor can we determine the SObjectType anyway
@@ -258,6 +283,7 @@ public virtual class fflib_Application
258283 * @param relatedRecords used to extract the related record Ids, e.g. Opportunity records
259284 * @param relationshipField field in the passed records that contains the relationship records to query, e.g. Opportunity.AccountId
260285 **/
286+ @NamespaceAccessible
261287 public virtual List <SObject > selectByRelationship (List <SObject > relatedRecords , SObjectField relationshipField )
262288 {
263289 Set <Id > relatedIds = new Set <Id >();
@@ -271,6 +297,7 @@ public virtual class fflib_Application
271297 }
272298
273299 @TestVisible
300+ @NamespaceAccessible
274301 protected virtual void setMock (fflib_ISObjectSelector selectorInstance )
275302 {
276303 m_sObjectByMockSelector .put (selectorInstance .sObjectType (), selectorInstance );
@@ -280,17 +307,22 @@ public virtual class fflib_Application
280307 /**
281308 * Class implements a Domain class factory
282309 **/
310+ @NamespaceAccessible
283311 public virtual class DomainFactory implements fflib_IDomainFactory
284312 {
313+ @NamespaceAccessible
285314 protected fflib_Application.SelectorFactory m_selectorFactory ;
286315
316+ @NamespaceAccessible
287317 protected Map <Object , Type > constructorTypeByObject ;
288318
319+ @NamespaceAccessible
289320 protected Map <Object , fflib_IDomain > mockDomainByObject ;
290321
291322 /**
292323 * Constructs a Domain factory
293324 **/
325+ @NamespaceAccessible
294326 public DomainFactory () { }
295327
296328 /**
@@ -302,6 +334,7 @@ public virtual class fflib_Application
302334 * @param selectorFactory , e.g. Application.Selector
303335 * @param constructorTypeByObject Map of Domain classes by ObjectType
304336 **/
337+ @NamespaceAccessible
305338 public DomainFactory (fflib_Application.SelectorFactory selectorFactory ,
306339 Map <Object , Type > constructorTypeByObject )
307340 {
@@ -319,6 +352,7 @@ public virtual class fflib_Application
319352 * @param selectorFactory, e.g. Application.Selector
320353 * @param sObjectByDomainConstructorType Map of Apex classes by SObjectType
321354 **/
355+ @NamespaceAccessible
322356 public DomainFactory (fflib_Application.SelectorFactory selectorFactory ,
323357 Map <SObjectType , Type > sObjectByDomainConstructorType )
324358 {
@@ -335,6 +369,7 @@ public virtual class fflib_Application
335369 * @param recordIds A list of Id's of the same type
336370 * @exception Throws an exception via the Selector Factory if the Ids are not all of the same SObjectType
337371 **/
372+ @NamespaceAccessible
338373 public virtual fflib_IDomain newInstance (Set <Id > recordIds )
339374 {
340375 return newInstance (m_selectorFactory .selectById (recordIds ));
@@ -349,6 +384,7 @@ public virtual class fflib_Application
349384 * @exception Throws an exception if the SObjectType cannot be determined from the list
350385 * or the constructor for Domain class was not registered for the SObjectType
351386 **/
387+ @NamespaceAccessible
352388 public virtual fflib_IDomain newInstance (List <SObject > records )
353389 {
354390 SObjectType domainSObjectType = records .getSObjectType ();
@@ -358,6 +394,7 @@ public virtual class fflib_Application
358394 return newInstance ((List <Object >) records , (Object ) domainSObjectType );
359395 }
360396
397+ @NamespaceAccessible
361398 public virtual fflib_IDomain newInstance (List <Object > objects , Object objectType )
362399 {
363400 // Mock implementation?
@@ -401,6 +438,7 @@ public virtual class fflib_Application
401438 * @remark Will support List<SObject> but all records in the list will be assumed to be of
402439 * the type specified in sObjectType
403440 **/
441+ @NamespaceAccessible
404442 public virtual fflib_IDomain newInstance (List <SObject > records , SObjectType domainSObjectType )
405443 {
406444 if (domainSObjectType == null )
@@ -413,17 +451,20 @@ public virtual class fflib_Application
413451 }
414452
415453 @TestVisible
454+ @NamespaceAccessible
416455 protected virtual void setMock (fflib_ISObjectDomain mockDomain )
417456 {
418457 mockDomainByObject .put ((Object ) mockDomain .sObjectType (), (fflib_IDomain ) mockDomain );
419458 }
420459
421460 @TestVisible
461+ @NamespaceAccessible
422462 protected virtual void setMock (fflib_IDomain mockDomain )
423463 {
424464 mockDomainByObject .put (mockDomain .getType (), mockDomain );
425465 }
426466
467+ @NamespaceAccessible
427468 protected virtual Map <Object , Type > getConstructorTypeByObject (Map <SObjectType , Type > constructorTypeBySObjectType )
428469 {
429470 Map <Object , Type > result = new Map <Object , Type >();
@@ -438,10 +479,12 @@ public virtual class fflib_Application
438479 }
439480 }
440481
482+ @NamespaceAccessible
441483 public class ApplicationException extends Exception { }
442484
443485 /**
444486 * Exception representing a developer coding error, not intended for end user eyes
445487 **/
488+ @NamespaceAccessible
446489 public class DeveloperException extends Exception { }
447490}
0 commit comments