티스토리 뷰

공부

[kotlin] methodName & className

승가비 2022. 7. 19. 23:37
728x90
object CommonUtils {
    inline fun methodName(): String = object {}::class.java.enclosingMethod.name
    inline fun className(): String = object {}::class.java.enclosingClass.simpleName
}

https://stackoverflow.com/questions/48181751/get-name-of-current-function-in-kotlin

 

Get name of current function in Kotlin

Update How can I get function name which is currently being execute using Kotlin? I'm trying to get the function name of the function which is currently being execute as below but it's always co...

stackoverflow.com

 

728x90

'공부' 카테고리의 다른 글

Multi-armed Bandit  (0) 2022.07.20
Entity, DAO, DTO가 무엇이며 왜 사용할까?  (0) 2022.07.20
[Gitlab] SQL Style Guide  (0) 2022.07.19
[Redis] LLEN O(1)  (0) 2022.07.19
[Redis] redis-cli shutdown  (0) 2022.07.19
댓글