Skip to content

Commit 3ee8524

Browse files
committed
Filter JoinQuery refactoring
1 parent 47885a5 commit 3ee8524

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

force-app/main/default/classes/SOQL.cls

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -948,12 +948,11 @@ public inherited sharing class SOQL implements Queryable {
948948
}
949949
}
950950

951-
public class Filter implements FilterClause, SoqlFilter {
951+
public virtual class Filter implements FilterClause, SoqlFilter {
952952
private String field;
953953
private String comperator;
954-
955954
private Object value;
956-
private JoinQuery joinQuery;
955+
957956

958957
private Binder binder;
959958

@@ -1064,12 +1063,6 @@ public inherited sharing class SOQL implements Queryable {
10641063
return set('NOT IN', inList);
10651064
}
10661065

1067-
private Filter set(String comperator, Object value) {
1068-
this.value = value;
1069-
this.comperator = comperator;
1070-
return this;
1071-
}
1072-
10731066
public Filter isIn(JoinQuery joinQuery) {
10741067
return set('IN', joinQuery);
10751068
}
@@ -1078,8 +1071,8 @@ public inherited sharing class SOQL implements Queryable {
10781071
return set('NOT IN', joinQuery);
10791072
}
10801073

1081-
private Filter set(String comperator, JoinQuery joinQuery) {
1082-
this.joinQuery = joinQuery;
1074+
private Filter set(String comperator, Object value) {
1075+
this.value = value;
10831076
this.comperator = comperator;
10841077
return this;
10851078
}
@@ -1101,8 +1094,8 @@ public inherited sharing class SOQL implements Queryable {
11011094
}
11021095

11031096
public String build() {
1104-
if (joinQuery != null) {
1105-
return field + ' ' + comperator + ' (' + joinQuery.build() + ')';
1097+
if (value instanceOf JoinQuery) {
1098+
return field + ' ' + comperator + ' (' + ((JoinQuery) value).build() + ')';
11061099
}
11071100

11081101
return field + ' ' + comperator + ' :' + binder.bind(value);

0 commit comments

Comments
 (0)