I've created an interface within a managed package that installers can implement (much like the example here and Making your managed package extensible with Apex Plugins). Clients can then configure their class name in a custom setting and I invoke it as required.
Given just the class name as a string, how can I determine if the class it represents implements my interface?
Do I need to construct an instance from the Type so I can use instanceOf?
string className = 'someCustomClientClass';
Type t = Type.forName(className);
object testInstance = t.newInstance();
System.assert(testInstance instanceOf SomeClass.SomeInterface);
I guess this will work (with some additional checks that the type actually exists), but I'd prefer to just rely on the Type object rather than creating an instance and invoking whatever their constructor does.