-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a8a8899
commit ee053b3
Showing
2 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
force-app/main/default/classes/proxies/AggregateResultProxy.cls
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
public with sharing class AggregateResultProxy { | ||
private Map<String, Object> valuesByAlias = new Map<String, Object>(); | ||
|
||
private AggregateResultProxy() { | ||
} | ||
|
||
public static AggregateResultProxy fromAggregateResult(AggregateResult item) { | ||
String itemJson = JSON.serialize(item); | ||
AggregateResultProxy proxy = new AggregateResultProxy(); | ||
proxy.valuesByAlias = (Map<String, Object>) JSON.deserializeUntyped( | ||
itemJson | ||
); | ||
return proxy; | ||
} | ||
|
||
public static AggregateResultProxy fromMap(Map<String, Object> pairs) { | ||
AggregateResultProxy proxy = new AggregateResultProxy(); | ||
proxy.valuesByAlias = new Map<String, Object>(pairs); | ||
return proxy; | ||
} | ||
|
||
public static AggregateResultProxy fromPair(String key, Object value) { | ||
AggregateResultProxy proxy = new AggregateResultProxy(); | ||
proxy.valuesByAlias = new Map<String, Object>{ key => value }; | ||
return proxy; | ||
} | ||
|
||
public Map<String, Object> getValuesByAlias() { | ||
return this.valuesByAlias; | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
force-app/main/default/classes/proxies/AggregateResultProxy.cls-meta.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
<apiVersion>61.0</apiVersion> | ||
<status>Active</status> | ||
</ApexClass> |