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
freshstart forcefreshstart force 

Reflection / Introspection Support

Does Apex have Reflection / Introspection sort of support?

CoderTimCoderTim

+1

 

Does anybody know the answer to this?

tes2tes2
No, the best you can do is cast the apex objects to JSON and parse. But that wont give you the datatype, property scope or methods.

see JSON.serialize()
cleveraardvarkcleveraardvark
Apex supports introspection using by using tokens or the describeSObjects Schema method. DescribeSObjectResult has about 26 methods, including getSobjectType(), isCustom(), & getChildRelationships()
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_dynamic_describe_objects_understanding.htm

You can get methods using the tooling api.
https://developer.salesforce.com/forums/?id=906F0000000MISBIA4