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

Commit 6fe1779

Browse files
committed
KParameterからKClassを取り出す共通関数を追加
1 parent 90519b2 commit 6fe1779

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/main/kotlin/com/mapk/fastkfunction/InternalFunctions.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.mapk.fastkfunction
22

33
import java.lang.reflect.Method
4+
import kotlin.reflect.KClass
45
import kotlin.reflect.KParameter
56

67
/**
@@ -12,6 +13,14 @@ import kotlin.reflect.KParameter
1213
*/
1314
internal val Method.declaringObject: Any? get() = declaringClass.kotlin.objectInstance
1415

16+
/**
17+
* Get KParameters KClass.
18+
*
19+
* @receiver KParameter.
20+
* @returns KClass.
21+
*/
22+
internal val KParameter.clazz: KClass<*> get() = this.type.classifier as KClass<*>
23+
1524
/**
1625
* Throw IllegalArgumentException if instance is null.
1726
*

0 commit comments

Comments
 (0)