
name.remal.kotlin.reflect.KFunction.kt Maven / Gradle / Ivy
package name.remal
import kotlin.reflect.KFunction
import kotlin.reflect.jvm.javaConstructor
import kotlin.reflect.jvm.javaMethod
fun KFunction<*>.getMetaAnnotations(type: Class): List {
val result = mutableSetOf()
javaMethod?.getMetaAnnotations(type)?.forEach { result.add(it) }
javaConstructor?.getMetaAnnotations(type)?.forEach { result.add(it) }
return result.toList()
}
fun KFunction<*>.getMetaAnnotation(type: Class) = getMetaAnnotations(type).firstOrNull()
fun KFunction<*>.hasMetaAnnotation(type: Class) = null != getMetaAnnotation(type)
© 2015 - 2025 Weber Informatics LLC | Privacy Policy