原文:java獲取調用此方法的上面的方法名、類

看源碼的時候,對於找類有點作用 ...

2017-01-10 10:30 0 3496 推薦指數:

查看詳情

Java獲取當前名和方法名

獲取class名: this.getClass().getName(); 或者 Thread.currentThread().getStackTrace()[1].getClassName(); 獲取方法名: Thread.currentThread().getStackTrace ...

Thu Jan 02 21:53:00 CST 2020 0 6876
java獲取調用當前方法方法名和行數

java獲取調用當前方法方法名和行數String className = Thread.currentThread().getStackTrace()[2].getClassName();//調用名 String methodName = Thread.currentThread ...

Thu Nov 21 21:35:00 CST 2019 0 359
 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM