Add "fflib_" prefix to primitive domain classes
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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
|
||||
{
|
||||
...
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user