I'm looking to create a generic wrapper APEX class with few property fields (string
type for now). Here is what my class would look like:
public class wCustomWrapper {
public String customProp1;
public String customProp2;
public String customProp3;
... (this property list could extend to 100 odd properties) ...
}
I have consumed this in a method where I'm trying to populate the customProp1
, customProp2
, ... field values.
In that method, I'm now looking to make this dynamic like populating as sObject fields, where I could just do sObject.put(fieldName, value)
, instead of hard referencing each property individually.
Can this be done in any way for a wrapper class?