1010 * - PropertyNamingConventions: It was intentional to make the lib more fluent and readable
1111 * - FieldDeclarationsShouldBeAtStart: Developer who uses lib should see what's important at start
1212 * - ApexDoc: Variable names are self-documented.
13+ * - FieldNamingConventions: It was intentional to make the lib more fluent and readable
1314 * - ExcessiveParameterList - Make methods similar to native SOQL
1415 * - NcssTypeCount - It is a library and we tried to put everything into ONE class
1516**/
16- @SuppressWarnings(' PMD.ExcessivePublicCount, PMD.ExcessiveClassLength, PMD.CyclomaticComplexity, PMD.CognitiveComplexity, PMD.PropertyNamingConventions, PMD.FieldDeclarationsShouldBeAtStart, PMD.ApexDoc, PMD.ExcessiveParameterList, PMD.NcssTypeCount' )
17+ @SuppressWarnings(' PMD.ExcessivePublicCount, PMD.ExcessiveClassLength, PMD.FieldNamingConventions, PMD. CyclomaticComplexity, PMD.CognitiveComplexity, PMD.PropertyNamingConventions, PMD.FieldDeclarationsShouldBeAtStart, PMD.ApexDoc, PMD.ExcessiveParameterList, PMD.NcssTypeCount' )
1718public virtual inherited sharing class SOQL implements Queryable {
1819 public interface Selector {
1920 Queryable query ();
@@ -673,7 +674,7 @@ public virtual inherited sharing class SOQL implements Queryable {
673674 }
674675
675676 public Queryable groupBy (String relationshipName , SObjectField field ) {
676- this .builder .fields .withGroupedField (relationshipName + ' .' + field );
677+ this .builder .fields .withGroupedField (relationshipName + ' .' + field . toString () );
677678 this .builder .groupBy .with (relationshipName , field );
678679 return this ;
679680 }
@@ -684,7 +685,7 @@ public virtual inherited sharing class SOQL implements Queryable {
684685 }
685686
686687 public Queryable groupByRollup (String relationshipName , SObjectField field ) {
687- this .builder .fields .withGroupedField (relationshipName + ' .' + field );
688+ this .builder .fields .withGroupedField (relationshipName + ' .' + field . toString () );
688689 return this .groupBy (relationshipName , field , ' ROLLUP' );
689690 }
690691
@@ -694,7 +695,7 @@ public virtual inherited sharing class SOQL implements Queryable {
694695 }
695696
696697 public Queryable groupByCube (String relationshipName , SObjectField field ) {
697- this .builder .fields .withGroupedField (relationshipName + ' .' + field );
698+ this .builder .fields .withGroupedField (relationshipName + ' .' + field . toString () );
698699 return this .groupBy (relationshipName , field , ' CUBE' );
699700 }
700701
@@ -706,7 +707,7 @@ public virtual inherited sharing class SOQL implements Queryable {
706707
707708 private Queryable groupBy (String relationshipName , SObjectField field , String function ) {
708709 this .builder .groupBy .with (relationshipName , field .toString (), function );
709- this .builder .fields .withGroupedField (relationshipName + ' .' + field );
710+ this .builder .fields .withGroupedField (relationshipName + ' .' + field . toString () );
710711 return this ;
711712 }
712713
@@ -900,7 +901,7 @@ public virtual inherited sharing class SOQL implements Queryable {
900901 }
901902
902903 public Map <String , SObject > toMap (String relationshipName , SObjectField targetKeyField ) {
903- this .with (relationshipName + ' .' + targetKeyField );
904+ this .with (relationshipName + ' .' + targetKeyField . toString () );
904905 return this .converter .transform (this .executor .toList ()).toMap (relationshipName , targetKeyField );
905906 }
906907
@@ -916,7 +917,7 @@ public virtual inherited sharing class SOQL implements Queryable {
916917 }
917918
918919 public Map <String , List <SObject >> toAggregatedMap (String relationshipName , SObjectField targetKeyField ) {
919- this .with (relationshipName + ' .' + targetKeyField );
920+ this .with (relationshipName + ' .' + targetKeyField . toString () );
920921 return this .converter .transform (this .executor .toList ()).toAggregatedMap (relationshipName , targetKeyField );
921922 }
922923
@@ -1168,7 +1169,7 @@ public virtual inherited sharing class SOQL implements Queryable {
11681169 }
11691170
11701171 public void add (String relationshipPath , SObjectField field ) {
1171- this .add (relationshipPath + ' .' + field );
1172+ this .add (relationshipPath + ' .' + field . toString () );
11721173 }
11731174
11741175 public Boolean isQualified (String field ) {
@@ -1181,11 +1182,11 @@ public virtual inherited sharing class SOQL implements Queryable {
11811182 private final Set <String > DATE_FUNCTIONS = new Set <String >{ ' CALENDAR_MONTH' , ' CALENDAR_QUARTER' , ' CALENDAR_YEAR' , ' DAY_IN_MONTH' , ' DAY_IN_WEEK' , ' DAY_IN_YEAR' , ' DAY_ONLY' , ' FISCAL_MONTH' , ' FISCAL_QUARTER' , ' FISCAL_YEAR' , ' HOUR_IN_DAY' , ' WEEK_IN_MONTH' , ' WEEK_IN_YEAR' };
11821183
11831184 public void add (String function , SObjectField field , String alias ) {
1184- this .add (function + ' (' + field + ' )' , alias );
1185+ this .add (function + ' (' + field . toString () + ' )' , alias );
11851186 }
11861187
11871188 public void add (String function , String relationship , SObjectField field , String alias ) {
1188- this .add (function + ' (' + relationship + ' .' + field + ' )' , alias );
1189+ this .add (function + ' (' + relationship + ' .' + field . toString () + ' )' , alias );
11891190 }
11901191
11911192 private void add (String aggregateFunction , String alias ) {
@@ -1561,7 +1562,7 @@ public virtual inherited sharing class SOQL implements Queryable {
15611562 }
15621563
15631564 public Filter with (String relationshipName , SObjectField field ) {
1564- return this .with (relationshipName + ' .' + field );
1565+ return this .with (relationshipName + ' .' + field . toString () );
15651566 }
15661567
15671568 public Filter with (String field ) {
@@ -1760,7 +1761,7 @@ public virtual inherited sharing class SOQL implements Queryable {
17601761 private String groupByFunction = ' ' ;
17611762
17621763 public void with (String relationshipName , SObjectField field ) {
1763- this .with (relationshipName + ' .' + field );
1764+ this .with (relationshipName + ' .' + field . toString () );
17641765 }
17651766
17661767 private void with (String field ) {
@@ -1786,7 +1787,7 @@ public virtual inherited sharing class SOQL implements Queryable {
17861787 }
17871788
17881789 public override String toString () {
1789- return ' GROUP BY ' + String .format ( this .groupByFunction , new List <String >{ String .join ( this .groupByFields , ' , ' ) });
1790+ return ' GROUP BY ' + String .format (this .groupByFunction , new List <String >{ String .join ( this .groupByFields , ' , ' ) });
17901791 }
17911792 }
17921793
@@ -2050,7 +2051,7 @@ public virtual inherited sharing class SOQL implements Queryable {
20502051 private String nullsOrder = ' FIRST' ;
20512052
20522053 public void with (String relationshipName , SObjectField field ) {
2053- this .with (relationshipName + ' .' + field );
2054+ this .with (relationshipName + ' .' + field . toString () );
20542055 }
20552056
20562057 public void with (String field ) {
@@ -2418,7 +2419,7 @@ public virtual inherited sharing class SOQL implements Queryable {
24182419 Map <String , List <String >> customValuesPerCustomKey = new Map <String , List <String >>();
24192420
24202421 for (SObject record : this .recordsToTransform ) {
2421- String key = record .get (keyField ). toString ( );
2422+ String key = String . valueOf ( record .get (keyField ));
24222423
24232424 if (! customValuesPerCustomKey .containsKey (key )) {
24242425 customValuesPerCustomKey .put (key , new List <String >());
0 commit comments