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
netspidernetspider 

How to make reflection programming in Salesforce

I want to know how you could write a bit of code to do true reflection programming in Salesforce

So say you have a piece of data which has the name of functions and the apex code will take this and run the function you have entered, so if a new function is deployed to Salesforce you dont need to change this class with another if statement and will still be able to run the new function
bob_buzzardbob_buzzard
You don't have reflection in Apex unfortunately, so you can't dynamically generate the name of a function and execute it. The best that you can do is to instantiate an interface from a type and execute known methods from the interface.  That stops you being tied into specific implementations of the interface, but your code still needs to know the names of the methods that it will invoke.