Using Type class to call static methods

Nope, at time of writing, the Type class can't do that.

The Type class can instantiate a class based on a string...and that's about it. Yes, there are a few other methods, but I've never come across a situation where I've actually used anything other than Type.forName() and Type.newInstance().

About the closest you'd be able to get is to have a public, non-static method in your target class (or any class, really) that calls your class's static method. I've personally used something close to this in the trigger framework I developed for my company (I retrieve a static class variable, rather than call a static method).

I can't quite put my finger on it, but having a public method that calls a class's static method feels like it defeats the purpose of having a static method.

Tags:

Dynamic

Apex