Is it possible to access Apex class properties dynamically? While we can create Object
's, and assign any other class to an Object
, I'm not sure how I can access the properties of these Object
's. Can anyone provide some documentation or references to code which would allow me to do this?
Example:
public class XYZ {
public string s1 { get; set; }
public string s2 { get; set; }
}
XYZ testXyzObj = new XYZ();
Object obj = testXyzObj;
// Method does not exist or incorrect signature: [Object].get(String)
String s1 = obj.get('s1');