annotation 1 썸네일형 리스트형 [Kotlin] Annotation & Annotation 처리에 관하여 Annotation을 사전에서 찾아보면 주석이다. 이 주석을 어디에 어떻게 추가하는지 알아보도록 하자. Kotlin Reflection interface의 hierarchy의 최상단은 annotatedElement 이다. 해당 인터페이스를 살펴보면 다음과 같다. 어노테이션을 기록하는 역할을 하는 것을 알 수 있다. Reflection interface의 최상단 interface가 위와 같다는 것은 reflection으로 다루던 모든 것이 annotation의 대상이 될 수 있다는 것을 알 수 있다. 아래는 코틀린 클래스의 annotation을 가져와 출력하는 예시이다. fun main { val kClass = Playground::class kClass.annotations.forEach { ann.. 이전 1 다음