获取方法调用者的类名或者方法名

//获取方法的调用者
String methodInvokeName = new Exception().getStackTrace()[1].getMethodName();
//获取方法的调用类
String classInvokeName = new Exception().getStackTrace()[1].getMethodName();

猜你喜欢

转载自www.cnblogs.com/kitor/p/10610085.html
今日推荐