public static String getCurrentMethodName() {
int level = 1;
StackTraceElement[] stacks = new Throwable().getStackTrace();
String methodName = stacks[level].getMethodName();
return methodName;
}

public static String getCurrentClassName() {
int level = 1;
StackTraceElement[] stacks = new Throwable().getStackTrace();
String className = stacks[level].getClassName();
return className;
}

相关文章:

  • 2022-12-23
  • 2022-02-01
  • 2021-10-01
  • 2021-07-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-02-24
  • 2021-09-27
  • 2022-02-11
  • 2022-12-23
相关资源
相似解决方案