Spring 22 – API 54

Querying for Classes That Implement an Interface

Check out the ApexTypeImplementer object that can be queried to find interfaces that implement a particular interface.

This object enables some interesting possible design patterns. For example: in the book custom metadata is used to identify classes that implement a trigger handler interface (ITriggerHandler). With this object it’s possible to avoid using custom metadata and just dynamically query for classes that implement that interface.

That said, I would not choose this approach. The custom metadata approach allows you to specify the order of trigger handlers – something that you’d need another mechanism to do with this object.

So while it’s good to be aware of this feature, its addition does not impact the accuracy and recommendations in the book.