Add "fflib_" prefix to primitive domain classes

This commit is contained in:
wim
2021-10-11 13:52:55 +01:00
parent d8e7872c2b
commit 4b58dbb2d1
29 changed files with 172 additions and 171 deletions
@@ -1,5 +1,5 @@
public inherited sharing class ${NAME}
extends SObjects
extends fflib_SObjects2
implements I${NAME}
{
public static I${NAME} newInstance(List<${SObject_API_Name}> records)
+29 -29
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 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 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 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.
@@ -120,7 +120,7 @@ public virtual class fflib_DynamicSelectorFactory
return this;
}
private class RelatedRecordsDomain extends SObjects
private class RelatedRecordsDomain extends fflib_SObjects2
{
public RelatedRecordsDomain(List<SObject> records)
{
@@ -536,35 +536,35 @@ public virtual with sharing class fflib_Criteria
// Method overrides
public fflib_Criteria inSet(Schema.SObjectField field, Set<Date> values)
{
return inSet(field, new Dates(values));
return inSet(field, new fflib_Dates(values));
}
public fflib_Criteria inSet(Schema.SObjectField field, Set<Datetime> values)
{
return inSet(field, new DateTimes(values));
return inSet(field, new fflib_DateTimes(values));
}
public fflib_Criteria inSet(Schema.SObjectField field, Set<Decimal> values)
{
return inSet(field, new Decimals(values));
return inSet(field, new fflib_Decimals(values));
}
public fflib_Criteria inSet(Schema.SObjectField field, Set<Double> values)
{
return inSet(field, new Doubles(values));
return inSet(field, new fflib_Doubles(values));
}
public fflib_Criteria inSet(Schema.SObjectField field, Set<Id> values)
{
return inSet(field, new Ids(values));
return inSet(field, new fflib_Ids(values));
}
public fflib_Criteria inSet(Schema.SObjectField field, Set<Integer> values)
{
return inSet(field, new Integers(values));
return inSet(field, new fflib_Integers(values));
}
public fflib_Criteria inSet(Schema.SObjectField field, Set<Long> values)
{
return inSet(field, new Longs(values));
return inSet(field, new fflib_Longs(values));
}
public fflib_Criteria inSet(Schema.SObjectField field, Set<String> values)
{
return inSet(field, new Strings(values));
return inSet(field, new fflib_Strings(values));
}
/**
* checks if the given sets contains the fields values
@@ -604,35 +604,35 @@ public virtual with sharing class fflib_Criteria
*/
public fflib_Criteria notInSet(Schema.SObjectField field, Set<Date> values)
{
return notInSet(field, new Dates(values));
return notInSet(field, new fflib_Dates(values));
}
public fflib_Criteria notInSet(Schema.SObjectField field, Set<Datetime> values)
{
return notInSet(field, new DateTimes(values));
return notInSet(field, new fflib_DateTimes(values));
}
public fflib_Criteria notInSet(Schema.SObjectField field, Set<Decimal> values)
{
return notInSet(field, new Decimals(values));
return notInSet(field, new fflib_Decimals(values));
}
public fflib_Criteria notInSet(Schema.SObjectField field, Set<Double> values)
{
return notInSet(field, new Doubles(values));
return notInSet(field, new fflib_Doubles(values));
}
public fflib_Criteria notInSet(Schema.SObjectField field, Set<Id> values)
{
return notInSet(field, new Ids(values));
return notInSet(field, new fflib_Ids(values));
}
public fflib_Criteria notInSet(Schema.SObjectField field, Set<Integer> values)
{
return notInSet(field, new Integers(values));
return notInSet(field, new fflib_Integers(values));
}
public fflib_Criteria notInSet(Schema.SObjectField field, Set<Long> values)
{
return notInSet(field, new Longs(values));
return notInSet(field, new fflib_Longs(values));
}
public fflib_Criteria notInSet(Schema.SObjectField field, Set<String> values)
{
return notInSet(field, new Strings(values));
return notInSet(field, new fflib_Strings(values));
}
public fflib_Criteria notInSet(Schema.SObjectField field, Set<Object> values)
{
@@ -1,5 +1,5 @@
/**
* File Name: DateTimes
* File Name: fflib_DateTimes
* @description Primitive domain for the object type DateTime
*
* @author architect ir. Wilhelmus G.J. Velzeboer
@@ -28,20 +28,20 @@
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
public virtual with sharing class DateTimes
extends Objects
public virtual with sharing class fflib_DateTimes
extends fflib_Objects2
{
public DateTimes(Set<Datetime> dateTimes)
public fflib_DateTimes(Set<Datetime> dateTimes)
{
super(new List<Datetime>(dateTimes));
}
public DateTimes(List<Datetime> dateTimes)
public fflib_DateTimes(List<Datetime> dateTimes)
{
super((List<Object>) dateTimes);
}
public DateTimes(List<Object> elements)
public fflib_DateTimes(List<Object> elements)
{
super(elements);
}
@@ -1,5 +1,5 @@
/**
* File Name: Dates
* File Name: fflib_Dates
* @description Primitive domain for the object type Date
*
* @author architect ir. Wilhelmus G.J. Velzeboer
@@ -28,20 +28,20 @@
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
public virtual class Dates
extends Objects
public virtual class fflib_Dates
extends fflib_Objects2
{
public Dates(Set<Date> dates)
public fflib_Dates(Set<Date> dates)
{
super(new List<Date>(dates));
}
public Dates(List<Date> dates)
public fflib_Dates(List<Date> dates)
{
super((List<Object>) dates);
}
public Dates(List<Object> elements)
public fflib_Dates(List<Object> elements)
{
super(elements);
}
@@ -1,5 +1,5 @@
/**
* File Name: Decimals
* File Name: fflib_Decimals
* @description Primitive domain for the object type Decimal
*
* @author architect ir. Wilhelmus G.J. Velzeboer
@@ -28,20 +28,20 @@
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
public virtual with sharing class Decimals
extends Objects
public virtual with sharing class fflib_Decimals
extends fflib_Objects2
{
public Decimals(Set<Decimal> decimals)
public fflib_Decimals(Set<Decimal> decimals)
{
super(new List<Decimal>(decimals));
}
public Decimals(List<Decimal> decimals)
public fflib_Decimals(List<Decimal> decimals)
{
super((List<Object>) decimals);
}
public Decimals(List<Object> elements)
public fflib_Decimals(List<Object> elements)
{
super(elements);
}
@@ -1,5 +1,5 @@
/**
* File Name: Doubles
* File Name: fflib_Doubles
* @description Primitive domain for the object type Double
*
* @author architect ir. Wilhelmus G.J. Velzeboer
@@ -28,20 +28,20 @@
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
public virtual with sharing class Doubles
extends Objects
public virtual with sharing class fflib_Doubles
extends fflib_Objects2
{
public Doubles(Set<Double> doubles)
public fflib_Doubles(Set<Double> doubles)
{
super(new List<Double>(doubles));
}
public Doubles(List<Double> doubles)
public fflib_Doubles(List<Double> doubles)
{
super((List<Object>) doubles);
}
public Doubles(List<Object> elements)
public fflib_Doubles(List<Object> elements)
{
super(elements);
}
@@ -1,5 +1,5 @@
/**
* File Name: Ids
* File Name: fflib_Ids
* @description Primitive domain for the object type Id
*
* @author architect ir. Wilhelmus G.J. Velzeboer
@@ -28,25 +28,25 @@
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
public virtual with sharing class Ids
extends Objects
public virtual with sharing class fflib_Ids
extends fflib_Objects2
{
public Ids(Set<Id> idSet)
public fflib_Ids(Set<Id> idSet)
{
super(new List<Id>(idSet));
}
public Ids(List<Id> ids)
public fflib_Ids(List<Id> ids)
{
super((List<Object>) ids);
}
public Ids(List<Object> elements)
public fflib_Ids(List<Object> elements)
{
super(elements);
}
public Ids(fflib_Objects objects)
public fflib_Ids(fflib_Objects objects)
{
super(getIdList(objects));
}
@@ -1,5 +1,5 @@
/**
* File Name: Integers
* File Name: fflib_Integers
* @description Primitive domain for the object type Integer
*
* @author architect ir. Wilhelmus G.J. Velzeboer
@@ -28,20 +28,20 @@
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
public virtual with sharing class Integers
extends Objects
public virtual with sharing class fflib_Integers
extends fflib_Objects2
{
public Integers(Set<Integer> integerSet)
public fflib_Integers(Set<Integer> integerSet)
{
super(new List<Integer>(integerSet));
}
public Integers(List<Integer> integerList)
public fflib_Integers(List<Integer> integerList)
{
super((List<Integer>) integerList);
}
public Integers(List<Object> elements)
public fflib_Integers(List<Object> elements)
{
super(elements);
}
@@ -1,5 +1,5 @@
/**
* File Name: Longs
* File Name: fflib_Longs
* @description Primitive domain for the object type Long
*
* @author architect ir. Wilhelmus G.J. Velzeboer
@@ -28,20 +28,20 @@
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
public virtual with sharing class Longs
extends Objects
public virtual with sharing class fflib_Longs
extends fflib_Objects2
{
public Longs(Set<Long> longs)
public fflib_Longs(Set<Long> longs)
{
super(new List<Long>(longs));
}
public Longs(List<Long> longs)
public fflib_Longs(List<Long> longs)
{
super((List<Object>) longs);
}
public Longs(List<Object> elements)
public fflib_Longs(List<Object> elements)
{
super(elements);
}
@@ -1,5 +1,5 @@
/**
* File Name: Objects
* File Name: fflib_Objects2
* @description Primitive domain for the type object
*
* @author architect ir. Wilhelmus G.J. Velzeboer
@@ -28,10 +28,10 @@
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
public virtual with sharing class Objects
public virtual with sharing class fflib_Objects2
extends fflib_Objects
{
public Objects(List<Object> elements)
public fflib_Objects2(List<Object> elements)
{
super(elements);
}
@@ -1,5 +1,5 @@
/**
* File Name: SObjects
* File Name: fflib_SObjects2
* @description Primitive domain for the object type SObject
*
* @author architect ir. Wilhelmus G.J. Velzeboer
@@ -28,7 +28,7 @@
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
public virtual class SObjects
public virtual class fflib_SObjects2
extends fflib_SObjects
implements fflib_ISObjects
{
@@ -39,7 +39,7 @@ public virtual class SObjects
*
* @param objects The Objects of type SObjectType, to contain inside the domain
*/
public SObjects(List<Object> objects)
public fflib_SObjects2(List<Object> objects)
{
// todo - assert of objects of type SObject
this((List<SObject>) objects);
@@ -50,7 +50,7 @@ public virtual class SObjects
*
* @param records The records to contain inside the domain
*/
public SObjects(List<SObject> records)
public fflib_SObjects2(List<SObject> records)
{
this(records, records.getSObjectType());
}
@@ -61,7 +61,7 @@ public virtual class SObjects
* @param records The records to contain inside the domain
* @param sObjectType The SObjectType of the records
*/
public SObjects(List<SObject> records, Schema.SObjectType sObjectType)
public fflib_SObjects2(List<SObject> records, Schema.SObjectType sObjectType)
{
super(records, sObjectType);
SObjectDescribe = sObjectType.getDescribe();
@@ -92,7 +92,7 @@ public virtual class SObjects
*
* @return Returns only the SObjects from the domain matching the given Ids.
*/
public virtual List<SObject> getRecords(Ids ids)
public virtual List<SObject> getRecords(fflib_Ids ids)
{
return getRecords(ids.getIds());
}
@@ -193,7 +193,7 @@ public virtual class SObjects
* @return The Date values of the given sObjectField, null values are omitted
*/
@TestVisible
protected virtual Dates getDateFieldValues(Schema.SObjectField sObjectField)
protected virtual fflib_Dates getDateFieldValues(Schema.SObjectField sObjectField)
{
Set<Date> result = new Set<Date>();
for (SObject record : getRecords())
@@ -202,7 +202,7 @@ public virtual class SObjects
if (fieldValue == null) continue;
result.add((Date) fieldValue);
}
return new Dates(result);
return new fflib_Dates(result);
}
/**
@@ -212,9 +212,9 @@ public virtual class SObjects
* @return The Date values of the given sObjectField, null values are omitted
*/
@TestVisible
protected virtual Dates getDateFieldValues(Schema.SObjectField sObjectField, fflib_Criteria criteria)
protected virtual fflib_Dates getDateFieldValues(Schema.SObjectField sObjectField, fflib_Criteria criteria)
{
return new SObjects(getRecords(criteria), getSObjectType())
return new fflib_SObjects2(getRecords(criteria), getSObjectType())
.getDateFieldValues(sObjectField);
}
@@ -224,7 +224,7 @@ public virtual class SObjects
* @return The DateTime values of the given sObjectField, null values are omitted
*/
@TestVisible
protected virtual DateTimes getDateTimeFieldValues(Schema.SObjectField sObjectField)
protected virtual fflib_DateTimes getDateTimeFieldValues(Schema.SObjectField sObjectField)
{
Set<Datetime> result = new Set<Datetime>();
for (SObject record : getRecords())
@@ -233,7 +233,7 @@ public virtual class SObjects
if (fieldValue == null) continue;
result.add((Datetime) fieldValue);
}
return new DateTimes(result);
return new fflib_DateTimes(result);
}
/**
@@ -243,9 +243,9 @@ public virtual class SObjects
* @return The DateTime values of the given sObjectField, null values are omitted
*/
@TestVisible
protected virtual DateTimes getDateTimeFieldValues(Schema.SObjectField sObjectField, fflib_Criteria criteria)
protected virtual fflib_DateTimes getDateTimeFieldValues(Schema.SObjectField sObjectField, fflib_Criteria criteria)
{
return new SObjects(getRecords(criteria), getSObjectType())
return new fflib_SObjects2(getRecords(criteria), getSObjectType())
.getDateTimeFieldValues(sObjectField);
}
@@ -255,7 +255,7 @@ public virtual class SObjects
* @return The Decimal values of the given sObjectField, null values are omitted
*/
@TestVisible
protected virtual Decimals getDecimalFieldValues(Schema.SObjectField sObjectField)
protected virtual fflib_Decimals getDecimalFieldValues(Schema.SObjectField sObjectField)
{
Set<Decimal> result = new Set<Decimal>();
for (SObject record : getRecords())
@@ -264,7 +264,7 @@ public virtual class SObjects
if (fieldValue == null) continue;
result.add((Decimal) fieldValue);
}
return new Decimals(result);
return new fflib_Decimals(result);
}
/**
@@ -274,9 +274,9 @@ public virtual class SObjects
* @return The Decimal values of the given sObjectField, null values are omitted
*/
@TestVisible
protected virtual Decimals getDecimalFieldValues(Schema.SObjectField sObjectField, fflib_Criteria criteria)
protected virtual fflib_Decimals getDecimalFieldValues(Schema.SObjectField sObjectField, fflib_Criteria criteria)
{
return new SObjects(getRecords(criteria), getSObjectType())
return new fflib_SObjects2(getRecords(criteria), getSObjectType())
.getDecimalFieldValues(sObjectField);
}
@@ -286,7 +286,7 @@ public virtual class SObjects
* @return The Double values of the given sObjectField, null values are omitted
*/
@TestVisible
protected virtual Doubles getDoubleFieldValues(Schema.SObjectField sObjectField)
protected virtual fflib_Doubles getDoubleFieldValues(Schema.SObjectField sObjectField)
{
Set<Double> result = new Set<Double>();
for (SObject record : getRecords())
@@ -295,7 +295,7 @@ public virtual class SObjects
if (fieldValue == null) continue;
result.add((Double) fieldValue);
}
return new Doubles(result);
return new fflib_Doubles(result);
}
/**
@@ -305,9 +305,9 @@ public virtual class SObjects
* @return The Double values of the given sObjectField, null values are omitted
*/
@TestVisible
protected virtual Doubles getDoubleFieldValues(Schema.SObjectField sObjectField, fflib_Criteria criteria)
protected virtual fflib_Doubles getDoubleFieldValues(Schema.SObjectField sObjectField, fflib_Criteria criteria)
{
return new SObjects(getRecords(criteria), getSObjectType())
return new fflib_SObjects2(getRecords(criteria), getSObjectType())
.getDoubleFieldValues(sObjectField);
}
@@ -440,7 +440,7 @@ public virtual class SObjects
* @return The Id values of the given sObjectField, null values are omitted
*/
@TestVisible
protected virtual Ids getIdFieldValues(Schema.SObjectField sObjectField)
protected virtual fflib_Ids getIdFieldValues(Schema.SObjectField sObjectField)
{
Set<Id> result = new Set<Id>();
for (SObject record : getRecords())
@@ -450,7 +450,7 @@ public virtual class SObjects
result.add(Id.valueOf(String.valueOf(fieldValue)));
}
return new Ids(result);
return new fflib_Ids(result);
// todo - alternative return to avoid code duplications: return new Ids(getFieldValues(sObjectField));
}
@@ -461,9 +461,9 @@ public virtual class SObjects
* @return The Id values of the given sObjectField, null values are omitted
*/
@TestVisible
protected virtual Ids getIdFieldValues(Schema.SObjectField sObjectField, fflib_Criteria criteria)
protected virtual fflib_Ids getIdFieldValues(Schema.SObjectField sObjectField, fflib_Criteria criteria)
{
return new SObjects(getRecords(criteria), getSObjectType())
return new fflib_SObjects2(getRecords(criteria), getSObjectType())
.getIdFieldValues(sObjectField);
}
@@ -473,7 +473,7 @@ public virtual class SObjects
* @return The Integer values of the given sObjectField, null values are omitted
*/
@TestVisible
protected virtual Integers getIntegerFieldValues(Schema.SObjectField sObjectField)
protected virtual fflib_Integers getIntegerFieldValues(Schema.SObjectField sObjectField)
{
Set<Integer> result = new Set<Integer>();
for (SObject record : getRecords())
@@ -483,7 +483,7 @@ public virtual class SObjects
result.add(Integer.valueOf(fieldValue));
}
return new Integers(result);
return new fflib_Integers(result);
}
/**
@@ -493,9 +493,9 @@ public virtual class SObjects
* @return The Integer values of the given sObjectField, null values are omitted
*/
@TestVisible
protected virtual Integers getIntegerFieldValues(Schema.SObjectField sObjectField, fflib_Criteria criteria)
protected virtual fflib_Integers getIntegerFieldValues(Schema.SObjectField sObjectField, fflib_Criteria criteria)
{
return new SObjects(getRecords(criteria), getSObjectType())
return new fflib_SObjects2(getRecords(criteria), getSObjectType())
.getIntegerFieldValues(sObjectField);
}
@@ -505,7 +505,7 @@ public virtual class SObjects
* @return The Long values of the given sObjectField, null values are omitted
*/
@TestVisible
protected virtual Longs getLongFieldValues(Schema.SObjectField sObjectField)
protected virtual fflib_Longs getLongFieldValues(Schema.SObjectField sObjectField)
{
Set<Long> result = new Set<Long>();
for (SObject record : getRecords())
@@ -514,7 +514,7 @@ public virtual class SObjects
if (fieldValue == null) continue;
result.add((Long) fieldValue);
}
return new Longs(result);
return new fflib_Longs(result);
}
/**
@@ -524,9 +524,9 @@ public virtual class SObjects
* @return The Long values of the given sObjectField, null values are omitted
*/
@TestVisible
protected virtual Longs getLongFieldValues(Schema.SObjectField sObjectField, fflib_Criteria criteria)
protected virtual fflib_Longs getLongFieldValues(Schema.SObjectField sObjectField, fflib_Criteria criteria)
{
return new SObjects(getRecords(criteria), getSObjectType())
return new fflib_SObjects2(getRecords(criteria), getSObjectType())
.getLongFieldValues(sObjectField);
}
@@ -699,14 +699,14 @@ public virtual class SObjects
* @return The String values of the given sObjectField
*/
@TestVisible
protected virtual Strings getStringFieldValues(Schema.SObjectField sObjectField)
protected virtual fflib_Strings getStringFieldValues(Schema.SObjectField sObjectField)
{
Set<String> result = new Set<String>();
for (SObject record : getRecords())
{
result.add(String.valueOf(record.get(sObjectField)));
}
return new Strings(result);
return new fflib_Strings(result);
}
/**
@@ -716,9 +716,9 @@ public virtual class SObjects
* @return The String values of the given sObjectField
*/
@TestVisible
protected virtual Strings getStringFieldValues(Schema.SObjectField sObjectField, fflib_Criteria criteria)
protected virtual fflib_Strings getStringFieldValues(Schema.SObjectField sObjectField, fflib_Criteria criteria)
{
return new SObjects(getRecords(criteria), getSObjectType())
return new fflib_SObjects2(getRecords(criteria), getSObjectType())
.getStringFieldValues(sObjectField);
}
@@ -732,7 +732,7 @@ public virtual class SObjects
@TestVisible
protected virtual void setFieldValue(Schema.SObjectField sObjectField, Object value, fflib_Criteria criteria)
{
new SObjects(getRecords(criteria), getSObjectType())
new fflib_SObjects2(getRecords(criteria), getSObjectType())
.setFieldValue(sObjectField, value);
}
}
@@ -1,5 +1,5 @@
/**
* File Name: Strings
* File Name: fflib_Strings
* @description Primitive domain for the object type String
*
* @author architect ir. Wilhelmus G.J. Velzeboer
@@ -28,20 +28,20 @@
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
public virtual with sharing class Strings
extends Objects
public virtual with sharing class fflib_Strings
extends fflib_Objects2
{
public Strings(Set<String> stringSet)
public fflib_Strings(Set<String> stringSet)
{
super(new List<String>(stringSet));
}
public Strings(List<String> stringList)
public fflib_Strings(List<String> stringList)
{
super(stringList);
}
public Strings(List<Object> elements)
public fflib_Strings(List<Object> elements)
{
super(elements);
@@ -80,7 +80,7 @@ private class fflib_ClassicDomainFactoryTest
}
}
public class MyDomain extends SObjects
public class MyDomain extends fflib_SObjects2
{
public MyDomain(List<Account> records)
{
@@ -48,9 +48,9 @@ private class PrimitiveDomainsTest
Date.newInstance(2022, 02, 02)
};
Dates datesA = new Dates(dateSet);
Dates DatesB = new Dates(dateList);
Dates DatesC = new Dates((List<Object>) dateList);
fflib_Dates datesA = new fflib_Dates(dateSet);
fflib_Dates DatesB = new fflib_Dates(dateList);
fflib_Dates DatesC = new fflib_Dates((List<Object>) dateList);
System.assert(datesA.getDateSet().containsAll(DatesB.getDates()));
System.assert(datesA.getDateSet().containsAll(DatesC.getDates()));
@@ -73,9 +73,9 @@ private class PrimitiveDomainsTest
Datetime.newInstance(2022, 02, 02, 01, 00, 00)
};
DateTimes datetimeA = new DateTimes(dateSet);
DateTimes datetimeB = new DateTimes(dateList);
DateTimes datetimeC = new DateTimes((List<Object>) dateList);
fflib_DateTimes datetimeA = new fflib_DateTimes(dateSet);
fflib_DateTimes datetimeB = new fflib_DateTimes(dateList);
fflib_DateTimes datetimeC = new fflib_DateTimes((List<Object>) dateList);
System.assert(datetimeA.getDateTimeSet().containsAll(datetimeB.getDateTimes()));
System.assert(datetimeA.getDateTimeSet().containsAll(datetimeC.getDateTimes()));
@@ -87,9 +87,9 @@ private class PrimitiveDomainsTest
final Set<Decimal> dataSet = new Set<Decimal> {5.5, 1.1, -1.1, -2.7};
final List<Decimal> dataList = new List<Decimal> {5.5, 1.1, -1.1, -2.7};
Decimals domainA = new Decimals(dataSet);
Decimals domainB = new Decimals(dataList);
Decimals domainC = new Decimals((List<Object>) dataList);
fflib_Decimals domainA = new fflib_Decimals(dataSet);
fflib_Decimals domainB = new fflib_Decimals(dataList);
fflib_Decimals domainC = new fflib_Decimals((List<Object>) dataList);
System.assert(domainA.getDecimalSet().containsAll(domainB.getDecimals()));
System.assert(domainA.getDecimalSet().containsAll(domainC.getDecimals()));
@@ -101,9 +101,9 @@ private class PrimitiveDomainsTest
final Set<Double> dataSet = new Set<Double> {1261992, 3.14159265};
final List<Double> dataList = new List<Double> {1261992, 3.14159265};
Doubles domainA = new Doubles(dataSet);
Doubles domainB = new Doubles(dataList);
Doubles domainC = new Doubles((List<Object>) dataList);
fflib_Doubles domainA = new fflib_Doubles(dataSet);
fflib_Doubles domainB = new fflib_Doubles(dataList);
fflib_Doubles domainC = new fflib_Doubles((List<Object>) dataList);
System.assert(domainA.getDoubleSet().containsAll(domainB.getDoubles()));
System.assert(domainA.getDoubleSet().containsAll(domainC.getDoubles()));
@@ -119,9 +119,9 @@ private class PrimitiveDomainsTest
fflib_IDGenerator.generate(Schema.Account.SObjectType)
};
Ids domainA = new Ids(dataSet);
Ids domainB = new Ids(new List<Id>(dataSet));
Ids domainC = new Ids((List<Object>) new List<Id>(dataSet));
fflib_Ids domainA = new fflib_Ids(dataSet);
fflib_Ids domainB = new fflib_Ids(new List<Id>(dataSet));
fflib_Ids domainC = new fflib_Ids((List<Object>) new List<Id>(dataSet));
System.assert(domainA.getIds().containsAll(domainB.getIdList()));
System.assert(domainA.getIds().containsAll(domainC.getIdList()));
@@ -138,7 +138,7 @@ private class PrimitiveDomainsTest
fflib_IDGenerator.generate(Schema.Account.SObjectType)
}));
Ids domainA = new Ids(data);
fflib_Ids domainA = new fflib_Ids(data);
System.assert(domainA.getIds().containsAll((List<Id>) data.getObjects()));
}
@@ -148,9 +148,9 @@ private class PrimitiveDomainsTest
{
final Set<Integer> dataSet = new Set<Integer> {1261, 31415};
Integers domainA = new Integers(dataSet);
Integers domainB = new Integers(new List<Integer>(dataSet));
Integers domainC = new Integers((List<Object>) new List<Integer>(dataSet));
fflib_Integers domainA = new fflib_Integers(dataSet);
fflib_Integers domainB = new fflib_Integers(new List<Integer>(dataSet));
fflib_Integers domainC = new fflib_Integers((List<Object>) new List<Integer>(dataSet));
System.assert(domainA.getIntegerSet().containsAll(domainB.getIntegers()));
System.assert(domainA.getIntegerSet().containsAll(domainC.getIntegers()));
@@ -161,9 +161,9 @@ private class PrimitiveDomainsTest
{
final Set<Long> dataSet = new Set<Long> {1261, 31415};
Longs domainA = new Longs(dataSet);
Longs domainB = new Longs(new List<Long>(dataSet));
Longs domainC = new Longs((List<Object>) new List<Long>(dataSet));
fflib_Longs domainA = new fflib_Longs(dataSet);
fflib_Longs domainB = new fflib_Longs(new List<Long>(dataSet));
fflib_Longs domainC = new fflib_Longs((List<Object>) new List<Long>(dataSet));
System.assert(domainA.getLongSet().containsAll(domainB.getLongs()));
System.assert(domainA.getLongSet().containsAll(domainC.getLongs()));
@@ -174,9 +174,9 @@ private class PrimitiveDomainsTest
{
final Set<String> dataSet = new Set<String> {'Hello', 'World'};
Strings domainA = new Strings(dataSet);
Strings domainB = new Strings(new List<String>(dataSet));
Strings domainC = new Strings((List<Object>) new List<String>(dataSet));
fflib_Strings domainA = new fflib_Strings(dataSet);
fflib_Strings domainB = new fflib_Strings(new List<String>(dataSet));
fflib_Strings domainC = new fflib_Strings((List<Object>) new List<String>(dataSet));
System.assert(domainA.getStringSet().containsAll(domainB.getStrings()));
System.assert(domainA.getStringSet().containsAll(domainC.getStrings()));
@@ -211,7 +211,7 @@ private class SObjectsTest
static void itShouldReturnRecordsById()
{
final Id idA = fflib_IDGenerator.generate(Schema.Account.SObjectType);
final Ids ids = new Ids(new Set<Id> {idA});
final fflib_Ids ids = new fflib_Ids(new Set<Id> {idA});
DomainAccounts domain = new DomainAccounts(
new List<Account>
{
@@ -336,7 +336,7 @@ private class SObjectsTest
}
private class DomainAccounts extends SObjects
private class DomainAccounts extends fflib_SObjects2
{
public DomainAccounts(List<SObject> records)
{