【反射】取得目前方法的名稱
/*
* 取得呼叫此方法的 methodName
*/
fun getMethodName(clazz: Any) {
var fullName = ""
val stackTrace = Thread.currentThread().stackTrace
if (stackTrace.size >= 3) {
val methodName = stackTrace[2].methodName
if (methodName.isEmpty() || className.isEmpty()) {
return redisEnable
}
fullName = "${className}.${methodName}"
}
}