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
bryanobryano 

How to get custom fields declared in an Apex class via Tooling API SymbolTable?

Hello, I'm wondering if there is a way to read in the contents of an Apex class and find all fields that are declared in the class.  For example, if I have method and in the method body I have a soql statement, is there a where to get the fields in the soql via a SymbolTable?

The methods field in the SymbolTable doesn't seem to give you the contents of what's inside of the method body and the externalReferences field in the SymbolTable seems to only give partial declarations within a method body.  It looks like there's no way to get the fields or soql statements that are used in a class.

I was hoping to get info with the Tooling API so that I could avoid having to build an Apex parser with Antlr.  Any guidance would be appreciated.