function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
vlotarevvlotarev 

StandardSetController sources

Does anybody know is it possible to look at the sources of StandardSetController class somewhere?

vlotarevvlotarev

Thank you for the reply. I saw that page, of course. I just wanted to look at the sources of that class. Is it Apex class itself?

Shailesh DeshpandeShailesh Deshpande

yes

vlotarevvlotarev

Good answer. So, are sources of that class available or this is a hidden property of Salesforce.com?

SteveBowerSteveBower

No.  I don't believe you can see the source for the StandardController or StandardSetController, etc.  These are internal to Salesforce.   What questions are you trying to resolve by examining the code?

vlotarevvlotarev

I am just wondering why in order to implement custom list controller that is mainly based on StandardSetController logic I need to implement a kind of wrapper class (as specified in the documentation) but not just to extend StandardSetController?

 

And why sources are not available if this is just a regular Apex code (that theoretically can be written by anybody)? Are some not documented features used?

SteveBowerSteveBower

Hi, I'm not entirely sure what you mean about the wrapper class as you can just use a page with a standardSetController. 

 

However, think of all the stuff that the Controllers are doing that you're not dealing with, especially marshaling the viewstate and calling the getters/setters/actions, etc. as the VF page interacts with the controller.   So, no, I'd assume it's not just regular Apex as in regular apex we don't have direct access to those data structures, and the View code isn't calling into our controllers unless it's through an extension of the standardControllers.

 

Best, Steve.

vlotarevvlotarev

Well, let me clarify what do I mean. According to the documentation (and many of samples here, in the forum) I need to write something like the code below in order to implement my custom list controller:

 

 

public with sharing class SampleProductListController {

// instantiate the StandardSetController from a query locator
public ApexPages.StandardSetController con {
get {
if(con == null) {

con = new ApexPages.StandardSetController(Database.getQueryLocator([...]));

// sets the number of records in each page set
con.setPageSize(20);
}
return con;
}

set;
}

<some other code>

 

 

I am wondering why insted of declaring StandardSetController property just not to extend this class? Something like:

 

public with sharing class SampleProductListController extends StandardSetController {
....
ahab1372ahab1372

good question, I don't know why. As far as I am concerned, I don't care too much as long as it works. Are you just wondering out of curiosity (which I absolutelyunderstand) or are there any problems with the way it is done?