How do I know which class called a method?
class A { B b = new B(); public void methodA() { Class callerClass = b.getCallerCalss(); // it should b
There's a method of observing the stacktrace
StackTraceElement[] elements = Thread.currentThread().getStackTrace()
Javadoc
The last element of the array represents the bottom of the stack, which is the least recent method invocation in the sequence.