diff --git a/dev-tools/assets/intelliJ/fileTemplates/AEPE - Domain Structure.cls b/dev-tools/assets/intelliJ/fileTemplates/AEPE - Domain Structure.cls index e72ac51..e2ce1c0 100644 --- a/dev-tools/assets/intelliJ/fileTemplates/AEPE - Domain Structure.cls +++ b/dev-tools/assets/intelliJ/fileTemplates/AEPE - Domain Structure.cls @@ -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) diff --git a/docs/criteria-based-filter.md b/docs/criteria-based-filter.md index 8f55aed..3422b6f 100644 --- a/docs/criteria-based-filter.md +++ b/docs/criteria-based-filter.md @@ -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. diff --git a/docs/domains/sobject.md b/docs/domains/sobject.md index 8411016..dcc2488 100644 --- a/docs/domains/sobject.md +++ b/docs/domains/sobject.md @@ -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 { - ... + ... } ``` diff --git a/docs/primitive-domains.md b/docs/primitive-domains.md index e82b4b2..34799d9 100644 --- a/docs/primitive-domains.md +++ b/docs/primitive-domains.md @@ -8,8 +8,9 @@ Instead of: List 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. diff --git a/sfdx-source/apex-extensions/main/application/dynamic/classes/fflib_DynamicSelectorFactory.cls b/sfdx-source/apex-extensions/main/application/dynamic/classes/fflib_DynamicSelectorFactory.cls index aed70c5..60e51e6 100644 --- a/sfdx-source/apex-extensions/main/application/dynamic/classes/fflib_DynamicSelectorFactory.cls +++ b/sfdx-source/apex-extensions/main/application/dynamic/classes/fflib_DynamicSelectorFactory.cls @@ -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 records) { diff --git a/sfdx-source/apex-extensions/main/default/classes/criteria/fflib_Criteria.cls b/sfdx-source/apex-extensions/main/default/classes/criteria/fflib_Criteria.cls index f8ac32d..cd61690 100644 --- a/sfdx-source/apex-extensions/main/default/classes/criteria/fflib_Criteria.cls +++ b/sfdx-source/apex-extensions/main/default/classes/criteria/fflib_Criteria.cls @@ -536,35 +536,35 @@ public virtual with sharing class fflib_Criteria // Method overrides public fflib_Criteria inSet(Schema.SObjectField field, Set values) { - return inSet(field, new Dates(values)); + return inSet(field, new fflib_Dates(values)); } public fflib_Criteria inSet(Schema.SObjectField field, Set values) { - return inSet(field, new DateTimes(values)); + return inSet(field, new fflib_DateTimes(values)); } public fflib_Criteria inSet(Schema.SObjectField field, Set values) { - return inSet(field, new Decimals(values)); + return inSet(field, new fflib_Decimals(values)); } public fflib_Criteria inSet(Schema.SObjectField field, Set values) { - return inSet(field, new Doubles(values)); + return inSet(field, new fflib_Doubles(values)); } public fflib_Criteria inSet(Schema.SObjectField field, Set values) { - return inSet(field, new Ids(values)); + return inSet(field, new fflib_Ids(values)); } public fflib_Criteria inSet(Schema.SObjectField field, Set values) { - return inSet(field, new Integers(values)); + return inSet(field, new fflib_Integers(values)); } public fflib_Criteria inSet(Schema.SObjectField field, Set values) { - return inSet(field, new Longs(values)); + return inSet(field, new fflib_Longs(values)); } public fflib_Criteria inSet(Schema.SObjectField field, Set 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 values) { - return notInSet(field, new Dates(values)); + return notInSet(field, new fflib_Dates(values)); } public fflib_Criteria notInSet(Schema.SObjectField field, Set values) { - return notInSet(field, new DateTimes(values)); + return notInSet(field, new fflib_DateTimes(values)); } public fflib_Criteria notInSet(Schema.SObjectField field, Set values) { - return notInSet(field, new Decimals(values)); + return notInSet(field, new fflib_Decimals(values)); } public fflib_Criteria notInSet(Schema.SObjectField field, Set values) { - return notInSet(field, new Doubles(values)); + return notInSet(field, new fflib_Doubles(values)); } public fflib_Criteria notInSet(Schema.SObjectField field, Set values) { - return notInSet(field, new Ids(values)); + return notInSet(field, new fflib_Ids(values)); } public fflib_Criteria notInSet(Schema.SObjectField field, Set values) { - return notInSet(field, new Integers(values)); + return notInSet(field, new fflib_Integers(values)); } public fflib_Criteria notInSet(Schema.SObjectField field, Set values) { - return notInSet(field, new Longs(values)); + return notInSet(field, new fflib_Longs(values)); } public fflib_Criteria notInSet(Schema.SObjectField field, Set values) { - return notInSet(field, new Strings(values)); + return notInSet(field, new fflib_Strings(values)); } public fflib_Criteria notInSet(Schema.SObjectField field, Set values) { diff --git a/sfdx-source/apex-extensions/main/default/classes/domains/DateTimes.cls b/sfdx-source/apex-extensions/main/default/classes/domains/fflib_DateTimes.cls similarity index 88% rename from sfdx-source/apex-extensions/main/default/classes/domains/DateTimes.cls rename to sfdx-source/apex-extensions/main/default/classes/domains/fflib_DateTimes.cls index 950618b..ddb6174 100644 --- a/sfdx-source/apex-extensions/main/default/classes/domains/DateTimes.cls +++ b/sfdx-source/apex-extensions/main/default/classes/domains/fflib_DateTimes.cls @@ -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 dateTimes) + public fflib_DateTimes(Set dateTimes) { super(new List(dateTimes)); } - public DateTimes(List dateTimes) + public fflib_DateTimes(List dateTimes) { super((List) dateTimes); } - public DateTimes(List elements) + public fflib_DateTimes(List elements) { super(elements); } diff --git a/sfdx-source/apex-extensions/main/default/classes/domains/DateTimes.cls-meta.xml b/sfdx-source/apex-extensions/main/default/classes/domains/fflib_DateTimes.cls-meta.xml similarity index 100% rename from sfdx-source/apex-extensions/main/default/classes/domains/DateTimes.cls-meta.xml rename to sfdx-source/apex-extensions/main/default/classes/domains/fflib_DateTimes.cls-meta.xml diff --git a/sfdx-source/apex-extensions/main/default/classes/domains/Dates.cls b/sfdx-source/apex-extensions/main/default/classes/domains/fflib_Dates.cls similarity index 90% rename from sfdx-source/apex-extensions/main/default/classes/domains/Dates.cls rename to sfdx-source/apex-extensions/main/default/classes/domains/fflib_Dates.cls index 5edb622..1d199cf 100644 --- a/sfdx-source/apex-extensions/main/default/classes/domains/Dates.cls +++ b/sfdx-source/apex-extensions/main/default/classes/domains/fflib_Dates.cls @@ -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 dates) + public fflib_Dates(Set dates) { super(new List(dates)); } - public Dates(List dates) + public fflib_Dates(List dates) { super((List) dates); } - public Dates(List elements) + public fflib_Dates(List elements) { super(elements); } diff --git a/sfdx-source/apex-extensions/main/default/classes/domains/Dates.cls-meta.xml b/sfdx-source/apex-extensions/main/default/classes/domains/fflib_Dates.cls-meta.xml similarity index 100% rename from sfdx-source/apex-extensions/main/default/classes/domains/Dates.cls-meta.xml rename to sfdx-source/apex-extensions/main/default/classes/domains/fflib_Dates.cls-meta.xml diff --git a/sfdx-source/apex-extensions/main/default/classes/domains/Decimals.cls b/sfdx-source/apex-extensions/main/default/classes/domains/fflib_Decimals.cls similarity index 89% rename from sfdx-source/apex-extensions/main/default/classes/domains/Decimals.cls rename to sfdx-source/apex-extensions/main/default/classes/domains/fflib_Decimals.cls index 673a2f4..8272065 100644 --- a/sfdx-source/apex-extensions/main/default/classes/domains/Decimals.cls +++ b/sfdx-source/apex-extensions/main/default/classes/domains/fflib_Decimals.cls @@ -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 decimals) + public fflib_Decimals(Set decimals) { super(new List(decimals)); } - public Decimals(List decimals) + public fflib_Decimals(List decimals) { super((List) decimals); } - public Decimals(List elements) + public fflib_Decimals(List elements) { super(elements); } diff --git a/sfdx-source/apex-extensions/main/default/classes/domains/Decimals.cls-meta.xml b/sfdx-source/apex-extensions/main/default/classes/domains/fflib_Decimals.cls-meta.xml similarity index 100% rename from sfdx-source/apex-extensions/main/default/classes/domains/Decimals.cls-meta.xml rename to sfdx-source/apex-extensions/main/default/classes/domains/fflib_Decimals.cls-meta.xml diff --git a/sfdx-source/apex-extensions/main/default/classes/domains/Doubles.cls b/sfdx-source/apex-extensions/main/default/classes/domains/fflib_Doubles.cls similarity index 89% rename from sfdx-source/apex-extensions/main/default/classes/domains/Doubles.cls rename to sfdx-source/apex-extensions/main/default/classes/domains/fflib_Doubles.cls index e1b18ca..b801d84 100644 --- a/sfdx-source/apex-extensions/main/default/classes/domains/Doubles.cls +++ b/sfdx-source/apex-extensions/main/default/classes/domains/fflib_Doubles.cls @@ -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 doubles) + public fflib_Doubles(Set doubles) { super(new List(doubles)); } - public Doubles(List doubles) + public fflib_Doubles(List doubles) { super((List) doubles); } - public Doubles(List elements) + public fflib_Doubles(List elements) { super(elements); } diff --git a/sfdx-source/apex-extensions/main/default/classes/domains/Doubles.cls-meta.xml b/sfdx-source/apex-extensions/main/default/classes/domains/fflib_Doubles.cls-meta.xml similarity index 100% rename from sfdx-source/apex-extensions/main/default/classes/domains/Doubles.cls-meta.xml rename to sfdx-source/apex-extensions/main/default/classes/domains/fflib_Doubles.cls-meta.xml diff --git a/sfdx-source/apex-extensions/main/default/classes/domains/Ids.cls b/sfdx-source/apex-extensions/main/default/classes/domains/fflib_Ids.cls similarity index 90% rename from sfdx-source/apex-extensions/main/default/classes/domains/Ids.cls rename to sfdx-source/apex-extensions/main/default/classes/domains/fflib_Ids.cls index 48228a3..d3a1c85 100644 --- a/sfdx-source/apex-extensions/main/default/classes/domains/Ids.cls +++ b/sfdx-source/apex-extensions/main/default/classes/domains/fflib_Ids.cls @@ -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 idSet) + public fflib_Ids(Set idSet) { super(new List(idSet)); } - public Ids(List ids) + public fflib_Ids(List ids) { super((List) ids); } - public Ids(List elements) + public fflib_Ids(List elements) { super(elements); } - public Ids(fflib_Objects objects) + public fflib_Ids(fflib_Objects objects) { super(getIdList(objects)); } diff --git a/sfdx-source/apex-extensions/main/default/classes/domains/Ids.cls-meta.xml b/sfdx-source/apex-extensions/main/default/classes/domains/fflib_Ids.cls-meta.xml similarity index 100% rename from sfdx-source/apex-extensions/main/default/classes/domains/Ids.cls-meta.xml rename to sfdx-source/apex-extensions/main/default/classes/domains/fflib_Ids.cls-meta.xml diff --git a/sfdx-source/apex-extensions/main/default/classes/domains/Integers.cls b/sfdx-source/apex-extensions/main/default/classes/domains/fflib_Integers.cls similarity index 88% rename from sfdx-source/apex-extensions/main/default/classes/domains/Integers.cls rename to sfdx-source/apex-extensions/main/default/classes/domains/fflib_Integers.cls index f362643..8ffe89f 100644 --- a/sfdx-source/apex-extensions/main/default/classes/domains/Integers.cls +++ b/sfdx-source/apex-extensions/main/default/classes/domains/fflib_Integers.cls @@ -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 integerSet) + public fflib_Integers(Set integerSet) { super(new List(integerSet)); } - public Integers(List integerList) + public fflib_Integers(List integerList) { super((List) integerList); } - public Integers(List elements) + public fflib_Integers(List elements) { super(elements); } diff --git a/sfdx-source/apex-extensions/main/default/classes/domains/Integers.cls-meta.xml b/sfdx-source/apex-extensions/main/default/classes/domains/fflib_Integers.cls-meta.xml similarity index 100% rename from sfdx-source/apex-extensions/main/default/classes/domains/Integers.cls-meta.xml rename to sfdx-source/apex-extensions/main/default/classes/domains/fflib_Integers.cls-meta.xml diff --git a/sfdx-source/apex-extensions/main/default/classes/domains/Longs.cls b/sfdx-source/apex-extensions/main/default/classes/domains/fflib_Longs.cls similarity index 89% rename from sfdx-source/apex-extensions/main/default/classes/domains/Longs.cls rename to sfdx-source/apex-extensions/main/default/classes/domains/fflib_Longs.cls index ef724c1..e216589 100644 --- a/sfdx-source/apex-extensions/main/default/classes/domains/Longs.cls +++ b/sfdx-source/apex-extensions/main/default/classes/domains/fflib_Longs.cls @@ -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 longs) + public fflib_Longs(Set longs) { super(new List(longs)); } - public Longs(List longs) + public fflib_Longs(List longs) { super((List) longs); } - public Longs(List elements) + public fflib_Longs(List elements) { super(elements); } diff --git a/sfdx-source/apex-extensions/main/default/classes/domains/Longs.cls-meta.xml b/sfdx-source/apex-extensions/main/default/classes/domains/fflib_Longs.cls-meta.xml similarity index 100% rename from sfdx-source/apex-extensions/main/default/classes/domains/Longs.cls-meta.xml rename to sfdx-source/apex-extensions/main/default/classes/domains/fflib_Longs.cls-meta.xml diff --git a/sfdx-source/apex-extensions/main/default/classes/domains/Objects.cls b/sfdx-source/apex-extensions/main/default/classes/domains/fflib_Objects2.cls similarity index 93% rename from sfdx-source/apex-extensions/main/default/classes/domains/Objects.cls rename to sfdx-source/apex-extensions/main/default/classes/domains/fflib_Objects2.cls index 061982c..9a7dbcf 100644 --- a/sfdx-source/apex-extensions/main/default/classes/domains/Objects.cls +++ b/sfdx-source/apex-extensions/main/default/classes/domains/fflib_Objects2.cls @@ -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 elements) + public fflib_Objects2(List elements) { super(elements); } diff --git a/sfdx-source/apex-extensions/main/default/classes/domains/Objects.cls-meta.xml b/sfdx-source/apex-extensions/main/default/classes/domains/fflib_Objects2.cls-meta.xml similarity index 100% rename from sfdx-source/apex-extensions/main/default/classes/domains/Objects.cls-meta.xml rename to sfdx-source/apex-extensions/main/default/classes/domains/fflib_Objects2.cls-meta.xml diff --git a/sfdx-source/apex-extensions/main/default/classes/domains/SObjects.cls b/sfdx-source/apex-extensions/main/default/classes/domains/fflib_SObjects2.cls similarity index 88% rename from sfdx-source/apex-extensions/main/default/classes/domains/SObjects.cls rename to sfdx-source/apex-extensions/main/default/classes/domains/fflib_SObjects2.cls index e638763..85255f5 100644 --- a/sfdx-source/apex-extensions/main/default/classes/domains/SObjects.cls +++ b/sfdx-source/apex-extensions/main/default/classes/domains/fflib_SObjects2.cls @@ -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 objects) + public fflib_SObjects2(List objects) { // todo - assert of objects of type SObject this((List) objects); @@ -50,7 +50,7 @@ public virtual class SObjects * * @param records The records to contain inside the domain */ - public SObjects(List records) + public fflib_SObjects2(List 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 records, Schema.SObjectType sObjectType) + public fflib_SObjects2(List 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 getRecords(Ids ids) + public virtual List 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 result = new Set(); 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 result = new Set(); 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 result = new Set(); 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 result = new Set(); 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 result = new Set(); 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 result = new Set(); 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 result = new Set(); 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 result = new Set(); 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); } } \ No newline at end of file diff --git a/sfdx-source/apex-extensions/main/default/classes/domains/SObjects.cls-meta.xml b/sfdx-source/apex-extensions/main/default/classes/domains/fflib_SObjects2.cls-meta.xml similarity index 100% rename from sfdx-source/apex-extensions/main/default/classes/domains/SObjects.cls-meta.xml rename to sfdx-source/apex-extensions/main/default/classes/domains/fflib_SObjects2.cls-meta.xml diff --git a/sfdx-source/apex-extensions/main/default/classes/domains/Strings.cls b/sfdx-source/apex-extensions/main/default/classes/domains/fflib_Strings.cls similarity index 90% rename from sfdx-source/apex-extensions/main/default/classes/domains/Strings.cls rename to sfdx-source/apex-extensions/main/default/classes/domains/fflib_Strings.cls index 392aa6e..1c98a61 100644 --- a/sfdx-source/apex-extensions/main/default/classes/domains/Strings.cls +++ b/sfdx-source/apex-extensions/main/default/classes/domains/fflib_Strings.cls @@ -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 stringSet) + public fflib_Strings(Set stringSet) { super(new List(stringSet)); } - public Strings(List stringList) + public fflib_Strings(List stringList) { super(stringList); } - public Strings(List elements) + public fflib_Strings(List elements) { super(elements); diff --git a/sfdx-source/apex-extensions/main/default/classes/domains/Strings.cls-meta.xml b/sfdx-source/apex-extensions/main/default/classes/domains/fflib_Strings.cls-meta.xml similarity index 100% rename from sfdx-source/apex-extensions/main/default/classes/domains/Strings.cls-meta.xml rename to sfdx-source/apex-extensions/main/default/classes/domains/fflib_Strings.cls-meta.xml diff --git a/sfdx-source/apex-extensions/tests/classes/application/fflib_ClassicDomainFactoryTest.cls b/sfdx-source/apex-extensions/tests/classes/application/fflib_ClassicDomainFactoryTest.cls index 79b3c75..6342c70 100644 --- a/sfdx-source/apex-extensions/tests/classes/application/fflib_ClassicDomainFactoryTest.cls +++ b/sfdx-source/apex-extensions/tests/classes/application/fflib_ClassicDomainFactoryTest.cls @@ -80,7 +80,7 @@ private class fflib_ClassicDomainFactoryTest } } - public class MyDomain extends SObjects + public class MyDomain extends fflib_SObjects2 { public MyDomain(List records) { diff --git a/sfdx-source/apex-extensions/tests/classes/domains/PrimitiveDomainsTest.cls b/sfdx-source/apex-extensions/tests/classes/domains/PrimitiveDomainsTest.cls index 17fea0d..40e58e7 100644 --- a/sfdx-source/apex-extensions/tests/classes/domains/PrimitiveDomainsTest.cls +++ b/sfdx-source/apex-extensions/tests/classes/domains/PrimitiveDomainsTest.cls @@ -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) dateList); + fflib_Dates datesA = new fflib_Dates(dateSet); + fflib_Dates DatesB = new fflib_Dates(dateList); + fflib_Dates DatesC = new fflib_Dates((List) 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) dateList); + fflib_DateTimes datetimeA = new fflib_DateTimes(dateSet); + fflib_DateTimes datetimeB = new fflib_DateTimes(dateList); + fflib_DateTimes datetimeC = new fflib_DateTimes((List) dateList); System.assert(datetimeA.getDateTimeSet().containsAll(datetimeB.getDateTimes())); System.assert(datetimeA.getDateTimeSet().containsAll(datetimeC.getDateTimes())); @@ -87,9 +87,9 @@ private class PrimitiveDomainsTest final Set dataSet = new Set {5.5, 1.1, -1.1, -2.7}; final List dataList = new List {5.5, 1.1, -1.1, -2.7}; - Decimals domainA = new Decimals(dataSet); - Decimals domainB = new Decimals(dataList); - Decimals domainC = new Decimals((List) dataList); + fflib_Decimals domainA = new fflib_Decimals(dataSet); + fflib_Decimals domainB = new fflib_Decimals(dataList); + fflib_Decimals domainC = new fflib_Decimals((List) dataList); System.assert(domainA.getDecimalSet().containsAll(domainB.getDecimals())); System.assert(domainA.getDecimalSet().containsAll(domainC.getDecimals())); @@ -101,9 +101,9 @@ private class PrimitiveDomainsTest final Set dataSet = new Set {1261992, 3.14159265}; final List dataList = new List {1261992, 3.14159265}; - Doubles domainA = new Doubles(dataSet); - Doubles domainB = new Doubles(dataList); - Doubles domainC = new Doubles((List) dataList); + fflib_Doubles domainA = new fflib_Doubles(dataSet); + fflib_Doubles domainB = new fflib_Doubles(dataList); + fflib_Doubles domainC = new fflib_Doubles((List) 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(dataSet)); - Ids domainC = new Ids((List) new List(dataSet)); + fflib_Ids domainA = new fflib_Ids(dataSet); + fflib_Ids domainB = new fflib_Ids(new List(dataSet)); + fflib_Ids domainC = new fflib_Ids((List) new List(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) data.getObjects())); } @@ -148,9 +148,9 @@ private class PrimitiveDomainsTest { final Set dataSet = new Set {1261, 31415}; - Integers domainA = new Integers(dataSet); - Integers domainB = new Integers(new List(dataSet)); - Integers domainC = new Integers((List) new List(dataSet)); + fflib_Integers domainA = new fflib_Integers(dataSet); + fflib_Integers domainB = new fflib_Integers(new List(dataSet)); + fflib_Integers domainC = new fflib_Integers((List) new List(dataSet)); System.assert(domainA.getIntegerSet().containsAll(domainB.getIntegers())); System.assert(domainA.getIntegerSet().containsAll(domainC.getIntegers())); @@ -161,9 +161,9 @@ private class PrimitiveDomainsTest { final Set dataSet = new Set {1261, 31415}; - Longs domainA = new Longs(dataSet); - Longs domainB = new Longs(new List(dataSet)); - Longs domainC = new Longs((List) new List(dataSet)); + fflib_Longs domainA = new fflib_Longs(dataSet); + fflib_Longs domainB = new fflib_Longs(new List(dataSet)); + fflib_Longs domainC = new fflib_Longs((List) new List(dataSet)); System.assert(domainA.getLongSet().containsAll(domainB.getLongs())); System.assert(domainA.getLongSet().containsAll(domainC.getLongs())); @@ -174,9 +174,9 @@ private class PrimitiveDomainsTest { final Set dataSet = new Set {'Hello', 'World'}; - Strings domainA = new Strings(dataSet); - Strings domainB = new Strings(new List(dataSet)); - Strings domainC = new Strings((List) new List(dataSet)); + fflib_Strings domainA = new fflib_Strings(dataSet); + fflib_Strings domainB = new fflib_Strings(new List(dataSet)); + fflib_Strings domainC = new fflib_Strings((List) new List(dataSet)); System.assert(domainA.getStringSet().containsAll(domainB.getStrings())); System.assert(domainA.getStringSet().containsAll(domainC.getStrings())); diff --git a/sfdx-source/apex-extensions/tests/classes/domains/SObjectsTest.cls b/sfdx-source/apex-extensions/tests/classes/domains/SObjectsTest.cls index 1bc8d99..f8a9f24 100644 --- a/sfdx-source/apex-extensions/tests/classes/domains/SObjectsTest.cls +++ b/sfdx-source/apex-extensions/tests/classes/domains/SObjectsTest.cls @@ -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 {idA}); + final fflib_Ids ids = new fflib_Ids(new Set {idA}); DomainAccounts domain = new DomainAccounts( new List { @@ -336,7 +336,7 @@ private class SObjectsTest } - private class DomainAccounts extends SObjects + private class DomainAccounts extends fflib_SObjects2 { public DomainAccounts(List records) {