Is there a way to programmatically get a list of methods of a specified class?

I know I can get the class body by querying ApexClass. However, this just gives a string that I should then parse. Parsing is ok, but I would like to avoid it if there is a better method to do this.

What I'd like to get is only what already exists in Salesforce. When you go to Setup->Develop->Apex classes, choose a class and open the tab "Class summary", you can see the list of properties and methods with their signatures. So, do you know of any way to get to the same information programmatically?


The new Tooling API provides this access. Access to this data through Apex Code may be limited, however, depending on the size of the classes, etc involved. This is definitely something that would work through Visualforce though (which is basically how the Developer Console works; by leveraging the Tooling API to deploy code and build symbol maps).

  • The Tooling API sounds great, at least when you look at the functionalities. Do you maybe know how it could be used from APEX? – zdropic Oct 14 '13 at 15:23
  • You can use the REST API version from Apex Code, it appears. I'll see if I can write a demo. – sfdcfox Oct 14 '13 at 15:34
  • Actually, there's already code that demonstrates this. It's in the documentation. – sfdcfox Oct 14 '13 at 15:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.