I have a inner class
public class Outer {
public class Inner {
...
}
}
and need to get that running
System.assertEquals('Outer.Inner', getClassName(new Outer.Inner()));
I found out that you can get the inner class name, but not the outer class:
System.assertEquals('Inner', String.valueOf(classInstance).substring(0, String.valueOf(classInstance).indexOf(':'));
I could do a SOSL query on all ApexClass' body but that would be somewhat quirky...