java 获取调用类的类名和方法名 ...
java 获取调用类的类名和方法名 ...
Description Below I present you two different ways to get the current Class: Using Thread ...
获取class名: this.getClass().getName(); 或者 Thread.currentThread().getStackTrace()[1].getClassName(); 获取方法名: Thread.currentThread().getStackTrace ...
获取当前方法的名称空间、类名和方法名称 获取调用者类名和方法名 ...
...
很简单,直接看代码: ...
java获取调用当前方法的方法名和行数String className = Thread.currentThread().getStackTrace()[2].getClassName();//调用的类名 String methodName = Thread.currentThread ...