@@ -183,6 +183,52 @@ public abstract with sharing class fflib_SObjectSelector
183183 return m_enforceCRUD ;
184184 }
185185
186+ /**
187+ * Provides access to the builder containing the list of fields base queries are using, this is demand
188+ * created if one has not already been defined via setFieldListBuilder
189+ *
190+ * @depricated See newQueryFactory
191+ **/
192+ public fflib_StringBuilder.FieldListBuilder getFieldListBuilder ()
193+ {
194+ List <SObjectField > sObjectFields = new List <SObjectField >();
195+ for (fflib_QueryFactory .QueryField queryField : newQueryFactory ().getSelectedFields ())
196+ sObjectFields .add (queryField .getBaseField ());
197+ return new fflib_StringBuilder .FieldListBuilder (sObjectFields );
198+ }
199+
200+ /**
201+ * Use this method to override the default FieldListBuilder (created on demand via getFieldListBuilder) with a custom one,
202+ * warning, this will bypass anything getSObjectFieldList or getSObjectFieldSetList returns
203+ *
204+ * @depricated See newQueryFactory
205+ **/
206+ public void setFieldListBuilder (fflib_StringBuilder.FieldListBuilder fieldListBuilder )
207+ {
208+ // TODO: Consider if given the known use cases for this (dynamic selector optomisation) if it's OK to leave this as a null operation
209+ }
210+
211+ /**
212+ * Returns in string form a comma delimted list of fields as defined via getSObjectFieldList and optionally getSObjectFieldSetList
213+ *
214+ * @depricated See newQueryFactory
215+ **/
216+ public String getFieldListString ()
217+ {
218+ return getFieldListBuilder ().getStringValue ();
219+ }
220+
221+ /**
222+ * Returns in string form a comma delimted list of fields as defined via getSObjectFieldList and optionally getSObjectFieldSetList
223+ * @param relation Will prefix fields with the given relation, e.g. MyLookupField__r
224+ *
225+ * @depricated See newQueryFactory
226+ **/
227+ public String getRelatedFieldListString (String relation )
228+ {
229+ return getFieldListBuilder ().getStringValue (relation + ' .' );
230+ }
231+
186232 /**
187233 * Returns the string representaiton of the SObject this selector represents
188234 **/
@@ -393,4 +439,4 @@ public abstract with sharing class fflib_SObjectSelector
393439
394440 return queryFactory ;
395441 }
396- }
442+ }
0 commit comments