Add Objects implementation

This commit is contained in:
Wim Velzeboer
2021-08-23 12:53:02 +01:00
parent 19cb9c8809
commit 75b2b703e5
11 changed files with 89 additions and 9 deletions
+16
View File
@@ -34,6 +34,22 @@ Please have read the [contributing guide](./CONTRIBUTING.md) that will through t
You can also have a look at the open items in the [project(s)](./projects), feel free to pick an item from the kanban board! You can also have a look at the open items in the [project(s)](./projects), feel free to pick an item from the kanban board!
## Change Log
Some of the changes that have major impact are listed here;
### August 2021
**Added criteria based on formula; (1 OR 2) AND 3)**
```apex
new fflib_Criteria()
.formulaCriteria('(1 OR 2) AND 3')
.equalTo(Account.AccountNumber, '0001')
.equalTo(Account.AccountNumber, '0002')
.equalTo(Account.ShippingCountry, 'USA')
Evaluates:
(AccountNumber = '0001' OR AccountNumber = '0001') AND ShippingCountry = 'USA'
```
## Donations ## Donations
We are pleased to announce that the fflib-apex-extensions Project is accepting donations in the privacy-oriented cryptocurrency Monero (XMR) at the following address: We are pleased to announce that the fflib-apex-extensions Project is accepting donations in the privacy-oriented cryptocurrency Monero (XMR) at the following address:
@@ -29,7 +29,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * 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 public virtual with sharing class DateTimes
extends fflib_Objects extends Objects
{ {
public DateTimes(Set<Datetime> dateTimes) public DateTimes(Set<Datetime> dateTimes)
{ {
@@ -29,7 +29,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
public virtual class Dates public virtual class Dates
extends fflib_Objects extends Objects
{ {
public Dates(Set<Date> dates) public Dates(Set<Date> dates)
{ {
@@ -29,7 +29,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * 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 public virtual with sharing class Decimals
extends fflib_Objects extends Objects
{ {
public Decimals(Set<Decimal> decimals) public Decimals(Set<Decimal> decimals)
{ {
@@ -29,7 +29,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * 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 public virtual with sharing class Doubles
extends fflib_Objects extends Objects
{ {
public Doubles(Set<Double> doubles) public Doubles(Set<Double> doubles)
{ {
@@ -29,7 +29,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * 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 public virtual with sharing class Ids
extends fflib_Objects extends Objects
{ {
public Ids(Set<Id> idSet) public Ids(Set<Id> idSet)
{ {
@@ -29,7 +29,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * 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 public virtual with sharing class Integers
extends fflib_Objects extends Objects
{ {
public Integers(Set<Integer> integerSet) public Integers(Set<Integer> integerSet)
{ {
@@ -29,7 +29,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * 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 public virtual with sharing class Longs
extends fflib_Objects extends Objects
{ {
public Longs(Set<Long> longs) public Longs(Set<Long> longs)
{ {
@@ -0,0 +1,48 @@
/**
* File Name: Objects
* @description Primitive domain for the type object
*
* @author architect ir. Wilhelmus G.J. Velzeboer
*
* Copyright (c), W.G.J. Velzeboer,
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above author notice,
* this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* - Neither the name of the author nor the names of its contributors
* may be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* 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
extends fflib_Objects
{
public Objects(List<Object> elements)
{
super(elements);
}
/**
* @return Returns only the first occurrence in the list of strings contained in the domain.
*/
public Object getFirstObject()
{
if (isEmpty()) return null;
return getObjects().get(0);
}
}
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>51.0</apiVersion>
<status>Active</status>
</ApexClass>
@@ -29,7 +29,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * 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 public virtual with sharing class Strings
extends fflib_Objects extends Objects
{ {
public Strings(Set<String> stringSet) public Strings(Set<String> stringSet)
{ {
@@ -38,12 +38,13 @@ public virtual with sharing class Strings
public Strings(List<String> stringList) public Strings(List<String> stringList)
{ {
super((List<String>) stringList); super(stringList);
} }
public Strings(List<Object> elements) public Strings(List<Object> elements)
{ {
super(elements); super(elements);
} }
/** /**
@@ -61,4 +62,14 @@ public virtual with sharing class Strings
{ {
return (List<String>) getObjects(); return (List<String>) getObjects();
} }
/**
* @return Returns only the first occurrence in the list of strings contained in the domain.
*/
public String getFirst()
{
if (isEmpty()) return null;
return (String) getFirstObject();
}
} }