Add "fflib_" prefix to primitive domain classes

This commit is contained in:
wim
2021-10-05 10:22:23 +01:00
parent f3ee423925
commit a358fef3c9
29 changed files with 172 additions and 171 deletions
+31 -31
View File
@@ -41,39 +41,39 @@ How it can be applied in a Domain class:
```apex
public with sharing class Accounts
extends SObjects
implements IAccounts
extends fflib_SObjects2
implements IAccounts
{
private static final Integer LARGE_ACCOUNT_EMPLOYEE_NUMBERS = 500;
private static final Integer LARGE_ACCOUNT_EMPLOYEE_NUMBERS = 500;
public Accounts getByCountry(String countryName)
{
return new Accounts(
getRecords(
new AccountCriteria().shippingCountryEquals(countryName)
)
);
}
public Accounts getByNumberOfEmployeesGreaterThan(Integer numberOfEmployees)
{
return new Accounts(
getRecords(
new AccountCriteria().numberOfEmployeesGreaterThan(numberOfEmployees)
)
);
}
public Accounts getByLargeAccountsInCountry(String countryName)
{
return new Accounts(
getRecords(
new AccountCriteria()
.shippingCountryEquals(countryName)
.numberOfEmployeesGreaterThan(numberOfEmployees)
)
);
}
public Accounts getByCountry(String countryName)
{
return new Accounts(
getRecords(
new AccountCriteria().shippingCountryEquals(countryName)
)
);
}
public Accounts getByNumberOfEmployeesGreaterThan(Integer numberOfEmployees)
{
return new Accounts(
getRecords(
new AccountCriteria().numberOfEmployeesGreaterThan(numberOfEmployees)
)
);
}
public Accounts getByLargeAccountsInCountry(String countryName)
{
return new Accounts(
getRecords(
new AccountCriteria()
.shippingCountryEquals(countryName)
.numberOfEmployeesGreaterThan(numberOfEmployees)
)
);
}
}
```
In this example we see three filters; one for country, another for checking minimal number of employees and a third that combines the first two.
+2 -2
View File
@@ -6,9 +6,9 @@ The primitive domain SObject adds a lot of additional getter methods to the doma
This class should be used to extend Domain classes.
```apex
public class Accounts extends SObjects implements IAccounts
public class Accounts extends fflib_SObjects2 implements IAccounts
{
...
...
}
```
+2 -1
View File
@@ -8,8 +8,9 @@ Instead of:
List<String> myStrings = getSomeStrings();
```
You can write:
```apex
Strings myStrings = getSomeString();
fflib_Strings myStrings = getSomeString();
```
It is a small thing, but it makes things looks much nicer.