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
dke01dke01 

Invoke Class Dynamically

I want to get a list of classes at run time.  Such as spring would allow in java.  lIke a facorty.

 

Is there anyway to achive a similar result in APEX.

 

For example I want to get a list of all classes that implement a interface.  I have also named my classes consitantly so I can query for them

 

i.e.

 

Select Name from ApexClass where Status = 'Active' AND Name like 'My_XML%'

 

This returns 20 classes.  I want to create a new instance of each class and call a method on it.  Is this achiveable?

Best Answer chosen by Admin (Salesforce Developers) 
Anand@SAASAnand@SAAS

Reflection like implementation is not possible in Apex.

All Answers

Anand@SAASAnand@SAAS

Reflection like implementation is not possible in Apex.

This was selected as the best answer
dke01dke01

Thanks, that is what I thought ,  I just wanted someone else to confirm it.