Skip to content
This repository was archived by the owner on Jan 20, 2023. It is now read-only.

Commit 9f43739

Browse files
committed
KParameterからのクラス取得を追加
1 parent 0d3aecb commit 9f43739

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/main/kotlin/com/mapk/core/Functions.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package com.mapk.core
22

33
import kotlin.reflect.KClass
44
import kotlin.reflect.KFunction
5+
import kotlin.reflect.KParameter
56
import kotlin.reflect.full.companionObject
67
import kotlin.reflect.full.functions
78

@@ -21,3 +22,5 @@ inline fun <reified A : Annotation> KClass<*>.getAnnotatedFunctionsFromCompanion
2122
inline fun <reified A : Annotation, T> Collection<KFunction<T>>.getAnnotatedFunctions(): List<KFunction<T>> {
2223
return filter { function -> function.annotations.any { it is A } }
2324
}
25+
26+
fun KParameter.getKClass(): KClass<*> = type.classifier as KClass<*>

0 commit comments

Comments
 (0)